From: Jérémie Astor Date: Fri, 3 Jul 2020 10:30:36 +0000 (+0200) Subject: :art: Decl scoping X-Git-Tag: nightly~1454 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=43c0cea767f0901a1764177079a2d24d01ee88a4;p=gwion.git :art: Decl scoping --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index ec11950d..4247e7d0 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -66,7 +66,7 @@ ANN static m_bool scan1_decl(const Env env, const Exp_Decl* decl) { const Var_Decl var = list->self; CHECK_BB(isres(env, var->xid, exp_self(decl)->pos)) Type t = decl->type; - if(nspc_lookup_value2(env->curr, var->xid)) + if((!env->class_def || env->scope->depth) ? (nspc_lookup_value1 : nspc_lookup_value2)(env->curr, var->xid)) ERR_B(var->pos, _("variable %s has already been defined in the same scope..."), s_name(var->xid)) if(var->array) {