diff --git a/src/main/java/astGenerator/ASTGenerator.java b/src/main/java/astGenerator/ASTGenerator.java index fdcaf63..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 @@ -282,7 +283,6 @@ public class ASTGenerator extends DecafBaseVisitor { } } - //todo @Override public Node visitDotSubExpr(DecafParser.DotSubExprContext ctx) { if (ctx.IntValue() != null) { @@ -293,6 +293,8 @@ public class ASTGenerator extends DecafBaseVisitor { return new LocalVarIdentifier(identifier); } else if(ctx.instVar() != null) { return visitInstVar(ctx.instVar()); + } else if(ctx.methodCall() != null) { + return visitMethodCall(ctx.methodCall()); } else if(ctx.calcExpr() != null) { return visitCalcExpr(ctx.calcExpr()); }