From 43c0cea767f0901a1764177079a2d24d01ee88a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 3 Jul 2020 12:30:36 +0200 Subject: [PATCH] :art: Decl scoping --- src/parse/scan1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.43.0