From: Jérémie Astor Date: Mon, 1 Mar 2021 19:01:28 +0000 (+0100) Subject: :art: Improve @gack X-Git-Tag: nightly~906 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=2aa3ba274c46f35c094c5e4523b5274cb9c2834d;p=gwion.git :art: Improve @gack --- diff --git a/src/lib/object.c b/src/lib/object.c index d69f6695..afd7dffc 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -100,7 +100,7 @@ static ID_CHECK(opck_this) { ERR_O(exp_self(prim)->pos, _("keyword 'this' can be used only inside class definition...")) if(env->func && !vflag(env->func->value_ref, vflag_member)) ERR_O(exp_self(prim)->pos, _("keyword 'this' cannot be used inside static functions...")) - if(env->func && !strcmp(s_name(env->func->def->base->xid), "@gack")) + if(!exp_getuse(exp_self(prim)) && env->func && !strcmp(s_name(env->func->def->base->xid), "@gack")) return get_gack(env->class_def->info->parent); // get_gack ? return env->class_def; } diff --git a/src/parse/check.c b/src/parse/check.c index afc4f301..f652149b 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -289,6 +289,7 @@ ANN static Type prim_owned(const Env env, const Symbol *data) { const Value v = exp->d.prim.value; const m_str name = !GET_FLAG(v, static) ? "this" : v->from->owner_class->name; const Exp base = new_prim_id(env->gwion->mp, insert_symbol(name), prim_pos(data)); + exp_setuse(base, 1); exp->exp_type = ae_exp_dot; exp->d.exp_dot.base = base; exp->d.exp_dot.xid = *data;