bugfix mainmethod ast

This commit is contained in:
StefanZ3 2024-06-28 15:32:08 +02:00
parent 1358e3372f
commit 4b7cb0b150

View File

@ -34,7 +34,8 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
boolean hasMain;
if(ctx.MainMethodDecl() != null) {
hasMain = true;
MethodDecl mainMethod = new MethodDecl(name, "void", "main", new ParameterList(new ArrayList<>()), new BlockStatement(new ArrayList<>(), null));
MethodDecl mainMethod = new MethodDecl(name, "void", "main", new ParameterList(new ArrayList<>()),(BlockStatement) visitBlock(ctx.block()));
methodDecls.add(mainMethod);
} else {
hasMain = false;
}