aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/shedlang/compiler/ast
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
-rw-r--r--src/test/java/org/shedlang/compiler/ast/typed/Typed.java19
-rw-r--r--src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java40
2 files changed, 39 insertions, 20 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/typed/Typed.java b/src/test/java/org/shedlang/compiler/ast/typed/Typed.java
index 75f54d36..ed58b4d4 100644
--- a/src/test/java/org/shedlang/compiler/ast/typed/Typed.java
+++ b/src/test/java/org/shedlang/compiler/ast/typed/Typed.java
@@ -5,6 +5,7 @@ import org.shedlang.compiler.types.Type;
import org.shedlang.compiler.types.Types;
import java.math.BigInteger;
+import java.util.List;
public class Typed {
private Typed() {
@@ -14,10 +15,28 @@ public class Typed {
return new TypedBoolLiteralNode(value, Sources.NULL);
}
+ public static TypedCallNode call(
+ TypedExpressionNode receiver,
+ List<TypedExpressionNode> positionalArgs,
+ List<TypedNamedArgNode> namedArgs
+ ) {
+ return new TypedCallNode(
+ receiver,
+ new TypedArgsNode(positionalArgs, namedArgs, Sources.NULL),
+ false,
+ Types.UNIT,
+ Sources.NULL
+ );
+ }
+
public static TypedIntLiteralNode intLiteral(int value) {
return new TypedIntLiteralNode(BigInteger.valueOf(value), Sources.NULL);
}
+ public static TypedNamedArgNode namedArg(String name, TypedExpressionNode expression) {
+ return new TypedNamedArgNode(name, expression, Sources.NULL);
+ }
+
public static TypedStringLiteralNode stringLiteral(String value) {
return new TypedStringLiteralNode(value, Sources.NULL);
}
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 11e7b38f..5cc0ce85 100644
--- a/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java
+++ b/src/test/java/org/shedlang/compiler/ast/untyped/Untyped.java
@@ -13,26 +13,6 @@ public class Untyped {
return new UntypedBoolLiteralNode(value, Sources.NULL);
}
- public static UntypedIntLiteralNode intLiteral(int value) {
- return new UntypedIntLiteralNode(BigInteger.valueOf(value), Sources.NULL);
- }
-
- public static UntypedIntLiteralNode intLiteral(BigInteger value) {
- return new UntypedIntLiteralNode(value, Sources.NULL);
- }
-
- public static UntypedNamedArgNode namedArg(String name, UntypedExpressionNode expression) {
- return new UntypedNamedArgNode(name, expression, Sources.NULL);
- }
-
- public static UntypedReferenceNode reference(String name) {
- return new UntypedReferenceNode(name, Sources.NULL);
- }
-
- public static UntypedStringLiteralNode stringLiteral(String value) {
- return new UntypedStringLiteralNode(value, Sources.NULL);
- }
-
public static UntypedCallNode call(
UntypedExpressionNode receiver,
List<UntypedExpressionNode> positionalArgs
@@ -52,4 +32,24 @@ public class Untyped {
Sources.NULL
);
}
+
+ public static UntypedIntLiteralNode intLiteral(int value) {
+ return new UntypedIntLiteralNode(BigInteger.valueOf(value), Sources.NULL);
+ }
+
+ public static UntypedIntLiteralNode intLiteral(BigInteger value) {
+ return new UntypedIntLiteralNode(value, Sources.NULL);
+ }
+
+ public static UntypedNamedArgNode namedArg(String name, UntypedExpressionNode expression) {
+ return new UntypedNamedArgNode(name, expression, Sources.NULL);
+ }
+
+ public static UntypedReferenceNode reference(String name) {
+ return new UntypedReferenceNode(name, Sources.NULL);
+ }
+
+ public static UntypedStringLiteralNode stringLiteral(String value) {
+ return new UntypedStringLiteralNode(value, Sources.NULL);
+ }
}