From 8cb6bb3a2a764a0038bc5fd3019209779ec6d71f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 7 Jul 2020 19:18:55 +0200 Subject: [PATCH] :bug: Fix env->global for decl --- src/parse/scan1.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 3e9d0d53..fdbfeda1 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -126,12 +126,13 @@ ANN m_bool scan1_exp_decl(const Env env, const Exp_Decl* decl) { CHECK_OB(decl->type) if(GET_FLAG(decl->type, const)) exp_setmeta(exp_self(decl), 1); -// SET_FLAG(decl->td, const); const m_bool global = GET_FLAG(decl->td, global); - if(global && !is_global(decl->type->e->owner, env->global_nspc)) - ERR_B(exp_self(decl)->pos, _("type '%s' is not global"), decl->type->name) - if(env->context) - env->context->global = 1; + if(global) { + if(env->context) + env->context->global = 1; + if(!is_global(decl->type->e->owner, env->global_nspc)) + ERR_B(exp_self(decl)->pos, _("type '%s' is not global"), decl->type->name) + } const m_uint scope = !global ? env->scope->depth : env_push_global(env); const m_bool ret = scan1_decl(env, decl); if(global) -- 2.43.0