diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-06-10 19:43:04 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-06-10 19:43:04 +0100 |
| commit | 4564de5f2b387ce71c906d980eb9d9ef2f5c4390 (patch) | |
| tree | 4d31a16a025b8f4cc776d32ff33648ba22290696 /src/test/java | |
| parent | 4089116972049123f447d72d1bd5cb5d7389c25e (diff) | |
Add free variables to define function instruction
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java b/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java index 4e0be235..1fa6c41a 100644 --- a/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java +++ b/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java @@ -17,6 +17,7 @@ public class StackCompilerFunctionDefinitionTests { .withName("f") .addPositionalParam("x", Typed.typeLevelReference("String", Types.STRING)) .addNamedParam("y", Typed.typeLevelReference("Int", Types.INT)) + .addFreeVariable("z") .addStatement(Typed.expressionStatement(Typed.stringLiteral("hello"))) .build(); @@ -32,6 +33,7 @@ public class StackCompilerFunctionDefinitionTests { has("namedParams", x -> x.namedParams(), isSequence( isDefineFunctionInstructionParam("y") )), + has("freeVariables", x -> x.freeVariables(), containsExactly(equalTo("z"))), has("body", x -> x.body(), isSequence( isPushStringInstruction("hello"), isDiscardInstruction() |
