From: Jérémie Astor Date: Sun, 15 Aug 2021 19:07:26 +0000 (+0200) Subject: :art: Fix bug with foreach X-Git-Tag: nightly~470^2~85 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=f06e208ff6682585caf5073fd36fed08fc7c8677;p=gwion.git :art: Fix bug with foreach --- diff --git a/src/clean.c b/src/clean.c index 3adaf1d9..71fd2bde 100644 --- a/src/clean.c +++ b/src/clean.c @@ -163,7 +163,8 @@ ANN static void clean_stmt_each(Clean *a, Stmt_Each b) { ++a->scope; clean_exp(a, b->exp); clean_stmt(a, b->body); - if (b->v) value_remref(b->v, a->gwion); +// if (b->v) value_remref(b->v, a->gwion); + if (b->v) mp_free(a->gwion->mp, Value, b); if (b->idx) clean_idx(a, b->idx); --a->scope; } diff --git a/src/parse/check.c b/src/parse/check.c index ce7cf859..17fe2b3a 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1161,6 +1161,7 @@ ANN static void check_idx(const Env env, struct EachIdx_ *const idx) { idx->v = new_value(env->gwion->mp, env->gwion->type[et_int], s_name(idx->sym)); valuefrom(env, idx->v->from, idx->pos); + idx->v->from->owner_class = NULL; set_vflag(idx->v, vflag_valid); nspc_add_value(env->curr, idx->sym, idx->v); }