diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-06-14 18:29:10 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-06-14 18:29:10 +0100 |
| commit | 78c3d52bc16fefbe35dbceb778f52618078b0854 (patch) | |
| tree | 3857e0897d02cea9e60dc1b4eb8cd721358bd3d0 /src/test/java | |
| parent | d267088721d40065b1e71521127073b471e84db5 (diff) | |
Use field names on namespace node in StackCompiler
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/ast/typed/Typed.java | 10 | ||||
| -rw-r--r-- | src/test/java/org/shedlang/compiler/stackir/StackCompilerNamespaceTests.java | 3 |
2 files changed, 11 insertions, 2 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 ae709dd4..ff87c8e8 100644 --- a/src/test/java/org/shedlang/compiler/ast/typed/Typed.java +++ b/src/test/java/org/shedlang/compiler/ast/typed/Typed.java @@ -51,7 +51,15 @@ public class Typed { NamespaceName namespaceName, List<TypedNamespaceStatementNode> body ) { - return new TypedNamespaceNode(namespaceName, body, List.of(), Sources.NULL); + return namespace(namespaceName, body, List.of()); + } + + public static TypedNamespaceNode namespace( + NamespaceName namespaceName, + List<TypedNamespaceStatementNode> body, + List<String> fieldNames + ) { + return new TypedNamespaceNode(namespaceName, body, fieldNames, Sources.NULL); } public static TypedStringLiteralNode stringLiteral(String value) { diff --git a/src/test/java/org/shedlang/compiler/stackir/StackCompilerNamespaceTests.java b/src/test/java/org/shedlang/compiler/stackir/StackCompilerNamespaceTests.java index 32ff72ba..1ed17236 100644 --- a/src/test/java/org/shedlang/compiler/stackir/StackCompilerNamespaceTests.java +++ b/src/test/java/org/shedlang/compiler/stackir/StackCompilerNamespaceTests.java @@ -27,7 +27,8 @@ public class StackCompilerNamespaceTests { .addNamedParam("y", Typed.typeLevelReference("Int", Types.INT)) .addStatement(Typed.expressionStatement(Typed.stringLiteral("hello"))) .build() - ) + ), + List.of("f") ); var instructions = StackCompiler.compileNamespace(node); |
