From c96d9fc1a139c779a6425f650c405d7ea97903a5 Mon Sep 17 00:00:00 2001 From: StefanZ3 Date: Thu, 20 Jun 2024 07:37:24 +0200 Subject: [PATCH] fix block in constructor in ast --- src/main/java/astGenerator/ASTGenerator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/astGenerator/ASTGenerator.java b/src/main/java/astGenerator/ASTGenerator.java index 123d34b..ab192db 100644 --- a/src/main/java/astGenerator/ASTGenerator.java +++ b/src/main/java/astGenerator/ASTGenerator.java @@ -67,7 +67,8 @@ public class ASTGenerator extends DecafBaseVisitor { 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