aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
index c758fc57..8868cd89 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java
@@ -75,6 +75,11 @@ public class PatioCodeGenDefineFunctionTests {
var context = PatioCodeGenContext.EMPTY;
context = PatioCodeGen.generateInstruction(instruction, context);
+
+ // We make sure there are some other instructions before setting the
+ // free variables so we can distinguish the free variable being copied
+ // into the closure upon closure creation (i.e. too soon) versus after
+ // the free variable is set.
context = context.addInstruction(Patio.localStore(Patio.localRef("a"), Patio.int_(42)));
context = context.addStackIrParam("a");
context = context.addInstruction(Patio.localStore(Patio.localRef("b"), Patio.int_(47)));