fix block in constructor in ast

This commit is contained in:
StefanZ3 2024-06-20 07:37:24 +02:00
parent b00979c1a8
commit c96d9fc1a1

View File

@ -67,7 +67,8 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
public Node visitConstuctorDecl(DecafParser.ConstuctorDeclContext ctx) {
String name = ctx.Identifier().getText();
ParameterList parameterList = (ParameterList) visit(ctx.parameterList());
return new MethodDecl("", null, name, parameterList, new BlockStatement(new ArrayList<>(), "void"));
BlockStatement block = (BlockStatement) visitBlock(ctx.block());
return new MethodDecl("", null, name, parameterList, block);
}
@Override