From b47c2c518bce736b74a9cd40d91e870694c017dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 30 Jun 2020 23:28:43 +0200 Subject: [PATCH] :art: Clean scan1_decl --- src/parse/scan1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 115f19cd..ec11950d 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -66,9 +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; - const Value former = ((!env->class_def && !env->scope->depth) ? - nspc_lookup_value1 : nspc_lookup_value0)(env->curr, var->xid); - if(former) + if(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) { @@ -85,7 +83,7 @@ ANN static m_bool scan1_decl(const Env env, const Exp_Decl* decl) { else ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name) } - const Value v = var->value = former ?: new_value(env->gwion->mp, t, s_name(var->xid)); + const Value v = var->value = new_value(env->gwion->mp, t, s_name(var->xid)); if(SAFE_FLAG(env->class_def, struct) && !GET_FLAG(decl->td, static)) { v->from->offset = env->class_def->size; env->class_def->size += t->size; -- 2.43.0