diff options
Diffstat (limited to 'pez.c')
| -rw-r--r-- | pez.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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)); } } |