Skip to content

Commit

Permalink
chore: move extern method checking to CodeGenerator#VisitMethodDeclar…
Browse files Browse the repository at this point in the history
…ation()
  • Loading branch information
R-unic committed Aug 2, 2024
2 parents 3435acb + 8aff30e commit 0df8e56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions RobloxCS/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,11 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)

public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
{
if (HasSyntax(node.Modifiers, SyntaxKind.ExternKeyword))
{
Logger.UnsupportedError(node, "Extern methods", useYet: false);
}

foreach (var attributeList in node.AttributeLists)
{
Visit(attributeList);
Expand Down
4 changes: 2 additions & 2 deletions RobloxCS/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static void CodegenWarning(SyntaxToken token, string message)
Warn($"{message}\n\t- {Utility.FormatLocation(lineSpan)}");
}

public static void UnsupportedError(SyntaxNode node, string subject, bool? useIs = false)
public static void UnsupportedError(SyntaxNode node, string subject, bool useIs = false, bool useYet = true)
{
CodegenError(node, $"{subject} {(useIs == true ? "is" : "are")} not yet supported, sorry!");
CodegenError(node, $"{subject} {(useIs == true ? "is" : "are")} not {(useYet ? "yet " : "")} supported, sorry!");
}

public static void CodegenError(SyntaxNode node, string message)
Expand Down
2 changes: 0 additions & 2 deletions RobloxCS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ This project includes the compiler and transformers.
- Overloaded methods
- Full qualification of types/namespaces inside of namespaces
- Macro `new T()` with collection types to `{}`
- `const` declarations
- Disable `extern` keyword
- Test MainTransformer more

## Will maybe be supported
Expand Down

0 comments on commit 0df8e56

Please sign in to comment.