diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-12 20:23:23 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-12 20:23:23 +0100 |
| commit | 5b999386f081b1f7e5259e26ffd33ea85e3e7a2b (patch) | |
| tree | b0bac012a2fcd9dae29295f0fe2dad3968b0bafb /src/test/java/org/shedlang/compiler/ast | |
| parent | 84807c9365168b8b5c0ce277a341d78a222cef33 (diff) | |
Add incomplete type-checking for if expressions
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java b/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java index 24ca7f87..8dddfa58 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java @@ -22,6 +22,10 @@ public class Untyped { ); } + public static UntypedBlockNode block(List<UntypedFunctionStatementNode> statements) { + return new UntypedBlockNode(statements, Sources.NULL); + } + public static UntypedBlockReturnNode blockReturn(UntypedExpressionNode expression) { return new UntypedBlockReturnNode(expression, Sources.NULL); } @@ -50,6 +54,13 @@ public class Untyped { ); } + public static UntypedConditionalBranchNode conditionalBranch( + UntypedExpressionNode condition, + UntypedBlockNode body + ) { + return new UntypedConditionalBranchNode(condition, body, Sources.NULL); + } + public static UntypedBinaryOperationNode equals( UntypedExpressionNode left, UntypedExpressionNode right @@ -70,6 +81,13 @@ public class Untyped { return new UntypedFunctionReturnNode(expression, Sources.NULL); } + public static UntypedIfNode if_( + List<UntypedConditionalBranchNode> conditionalBranches, + UntypedBlockNode elseBody + ) { + return new UntypedIfNode(conditionalBranches, elseBody, Sources.NULL); + } + public static UntypedIntLiteralNode intLiteral(int value) { return new UntypedIntLiteralNode(BigInteger.valueOf(value), Sources.NULL); } |
