Merge remote-tracking branch 'origin/master'

This commit is contained in:
Krauß, Josefine 2024-06-20 08:01:52 +02:00
commit 6585e67273

View File

@ -67,7 +67,8 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
public Node visitConstuctorDecl(DecafParser.ConstuctorDeclContext ctx) { public Node visitConstuctorDecl(DecafParser.ConstuctorDeclContext ctx) {
String name = ctx.Identifier().getText(); String name = ctx.Identifier().getText();
ParameterList parameterList = (ParameterList) visit(ctx.parameterList()); 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 @Override
@ -282,7 +283,6 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
} }
} }
//todo
@Override @Override
public Node visitDotSubExpr(DecafParser.DotSubExprContext ctx) { public Node visitDotSubExpr(DecafParser.DotSubExprContext ctx) {
if (ctx.IntValue() != null) { if (ctx.IntValue() != null) {
@ -293,6 +293,8 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
return new LocalVarIdentifier(identifier); return new LocalVarIdentifier(identifier);
} else if(ctx.instVar() != null) { } else if(ctx.instVar() != null) {
return visitInstVar(ctx.instVar()); return visitInstVar(ctx.instVar());
} else if(ctx.methodCall() != null) {
return visitMethodCall(ctx.methodCall());
} else if(ctx.calcExpr() != null) { } else if(ctx.calcExpr() != null) {
return visitCalcExpr(ctx.calcExpr()); return visitCalcExpr(ctx.calcExpr());
} }