summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pez.c2
-rw-r--r--test.pez3
2 files changed, 3 insertions, 2 deletions
diff --git a/pez.c b/pez.c
index d965095..16f7f2a 100644
--- a/pez.c
+++ b/pez.c
@@ -2192,7 +2192,7 @@ endscope(Comp *cm)
} else {
if (!l->has_k) {
--cm->fenv.nvars;
- if (l->mutable) {
+ if (l->mutable && l->scope > 0) {
TRY(compop(cm, Oclose) && compbyte(cm, l->index));
}
}
diff --git a/test.pez b/test.pez
index 2802fa9..1dbdfc6 100644
--- a/test.pez
+++ b/test.pez
@@ -1,8 +1,9 @@
@print: {[x] printf["%a\n", x]}
@Box: {[value]
+ @test = 7
#[{value},
- {[new] value = new}]
+ {[new] printf["test: %a\n", test] value = new}]
}