summaryrefslogtreecommitdiff
path: root/pez.c
diff options
context:
space:
mode:
Diffstat (limited to 'pez.c')
-rw-r--r--pez.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pez.c b/pez.c
index 16f7f2a..b2e590c 100644
--- a/pez.c
+++ b/pez.c
@@ -2170,6 +2170,7 @@ findupval(Comp *cm, Local **pl, struct fenv *fenv, const char *name)
Local *l = &fenv->prev->locals.at[i];
if (!strcmp(&cm->spool.at[l->sref], name)) {
assert(!l->has_k); // would've been found by findlocal earlier
+ l->captured = 1;
*pl = l;
return addupval(cm, fenv, l->index, l->isparam, !l->isparam);
}
@@ -2192,7 +2193,7 @@ endscope(Comp *cm)
} else {
if (!l->has_k) {
--cm->fenv.nvars;
- if (l->mutable && l->scope > 0) {
+ if (l->mutable && l->scope > 0 && l->captured) {
TRY(compop(cm, Oclose) && compbyte(cm, l->index));
}
}