From: Jérémie Astor Date: Mon, 15 Mar 2021 00:29:12 +0000 (+0100) Subject: :art: *Improve did you mean* X-Git-Tag: nightly~842 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=0358ac86db543de3ab38e282630c36244686fa2f;p=gwion.git :art: *Improve did you mean* --- diff --git a/src/parse/check.c b/src/parse/check.c index d2545a03..d2e479c9 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -253,8 +253,8 @@ ANN static Type check_dot(const Env env, const Exp_Dot *member) { return op_check(env, &opi); } -static inline Nspc value_owner(const Value v) { - return v ? v->from->owner : NULL; +static inline Nspc value_owner(const Env env, const Value v) { + return v ? v->from->owner : env->curr; } ANN static void check_upvalue(const Env env, const Exp_Primary *prim) { @@ -291,8 +291,7 @@ ANN static Type prim_id_non_res(const Env env, const Symbol *data) { if(!v || !vflag(v, vflag_valid) || (v->from->ctx && v->from->ctx->error)) { env_err(env, prim_pos(data), _("variable %s not legit at this point."), s_name(sym)); - if(v) - did_you_mean_nspc(value_owner(v) ?: env->curr, s_name(sym)); + did_you_mean_nspc(v ? value_owner(env, v) : env->curr, s_name(sym)); return NULL; } prim_self(data)->value = v;