aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-20 21:23:15 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-20 21:23:15 +0000
commit33408bfd92902d88193ccadedc60c9203932bd83 (patch)
tree3734ea6e8fe942e5ffec2d870fcccacd446791f4 /src/test/java
parent7af4bdee8f016e544a6fda75c04c7725333e7a2a (diff)
Add explanatory comment
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)));