aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-10-08 12:30:38 +0100
committerMichael Williamson <mike@zwobble.org>2023-10-08 12:30:38 +0100
commitccec3ef3e6d860df92daccd7e4d3016e6bd13f2b (patch)
tree54734b66dab2ccdfdb101eb6f3d90a8a4ea7ba77
parent44eccf59a95c04f2d72e01b1a98b8cb2afca2683 (diff)
Push temporary when generating Patio code for switch
-rw-r--r--snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected1
-rw-r--r--src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java2
2 files changed, 3 insertions, 0 deletions
diff --git a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
index a738ad65..af600e66 100644
--- a/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
+++ b/snapshots/[engine:junit-jupiter]/[class:org.shedlang.compiler.patio.PatioCodeGenSwitchTests]/[method:canGenerateCodeForSwitchWithSingleResult(org.shedlang.compiler.testing.snapshots.Snapshotter)].expected
@@ -56,4 +56,5 @@ Instructions:
)
Temporary stack:
+ * tmp__0
* other
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java
index 3510a249..66c2faf4 100644
--- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java
+++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGen.java
@@ -557,6 +557,8 @@ public class PatioCodeGen {
switch_.source()
));
+ context = context.temporaryPush(target);
+
yield context;
}