aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-07-20 14:47:06 +0100
committerMichael Williamson <mike@zwobble.org>2023-07-20 14:58:00 +0100
commit7f05f10981e0483f8a4817a7509b2dd5f27923e9 (patch)
tree7ba20a22cdabdd561e7fca1402ab8a1da70b5306 /src/test/java
parenta5a2588692d7c421d30ede8439e1f31df6f8c216 (diff)
Store free variables in closure
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalLoadTests.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
index ac510295..4f09ff3b 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
@@ -49,7 +49,9 @@ public class PatioCodeGenDefineFunctionTests {
),
Sources.NULL
);
- var context = PatioCodeGenContext.EMPTY;
+ var context = PatioCodeGenContext.EMPTY
+ .addStackIrLocal("a").context()
+ .addStackIrLocal("b").context();
var result = PatioCodeGen.generateInstruction(instruction, context);
@@ -73,7 +75,9 @@ public class PatioCodeGenDefineFunctionTests {
),
Sources.NULL
);
- var context = PatioCodeGenContext.EMPTY;
+ var context = PatioCodeGenContext.EMPTY
+ .addStackIrLocal("a").context()
+ .addStackIrLocal("b").context();
var result = PatioCodeGen.generateInstruction(instruction, context);
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalLoadTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalLoadTests.java
index 8ad1ba64..643c6d72 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalLoadTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenLocalLoadTests.java
@@ -15,7 +15,8 @@ public class PatioCodeGenLocalLoadTests {
@Test
public void localLoadPushesLocalOntoStack(Snapshotter snapshotter) throws IOException {
var stackIr = Instructions.localLoad("x");
- var context = PatioCodeGenContext.EMPTY;
+ var context = PatioCodeGenContext.EMPTY
+ .addStackIrLocal("x").context();
var result = PatioCodeGen.generateInstruction(stackIr, context);