From 33408bfd92902d88193ccadedc60c9203932bd83 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 20 Nov 2023 21:23:15 +0000 Subject: Add explanatory comment --- .../org/shedlang/compiler/patio/PatioCodeGenDefineFunctionTests.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/test/java') 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))); -- cgit v1.2.3