bugfix return
This commit is contained in:
parent
d7016df1ba
commit
6948797001
@ -140,8 +140,12 @@ public class ASTGenerator extends DecafBaseVisitor<Node> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node visitReturnStmt(DecafParser.ReturnStmtContext ctx) {
|
public Node visitReturnStmt(DecafParser.ReturnStmtContext ctx) {
|
||||||
|
if (ctx.expression() != null) {
|
||||||
Node expression = visitExpression(ctx.expression());
|
Node expression = visitExpression(ctx.expression());
|
||||||
return new ReturnStatement((IExpression) expression);
|
return new ReturnStatement((IExpression) expression);
|
||||||
|
} else {
|
||||||
|
return new ReturnStatement(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user