diff --git a/src/main/java/de/maishai/StatementGenerator.java b/src/main/java/de/maishai/StatementGenerator.java index 64916eb..db0d143 100644 --- a/src/main/java/de/maishai/StatementGenerator.java +++ b/src/main/java/de/maishai/StatementGenerator.java @@ -53,7 +53,7 @@ public class StatementGenerator extends DecafBaseVisitor { @Override public Statement visitReturnVoid(DecafParser.ReturnVoidContext ctx) { - return new Return(null); + return new ReturnVoid(); } @Override diff --git a/src/main/java/de/maishai/ast/records/ReturnVoid.java b/src/main/java/de/maishai/ast/records/ReturnVoid.java new file mode 100644 index 0000000..b3d1f08 --- /dev/null +++ b/src/main/java/de/maishai/ast/records/ReturnVoid.java @@ -0,0 +1,5 @@ +package de.maishai.ast.records; + + +public record ReturnVoid() implements Statement { +} diff --git a/src/main/java/de/maishai/ast/records/Statement.java b/src/main/java/de/maishai/ast/records/Statement.java index 5a36534..181c398 100644 --- a/src/main/java/de/maishai/ast/records/Statement.java +++ b/src/main/java/de/maishai/ast/records/Statement.java @@ -1,4 +1,4 @@ package de.maishai.ast.records; -public sealed interface Statement extends Node permits Assignment, Break, DoWhile, For, IfElse, MethodCall, New, Return, While { +public sealed interface Statement extends Node permits Assignment, Break, DoWhile, For, IfElse, MethodCall, New, Return, ReturnVoid, While { }