From: Jérémie Astor Date: Tue, 12 May 2020 16:16:24 +0000 (+0200) Subject: :art: Set scope in fptr arg parsing X-Git-Tag: nightly~1577 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=c5d972bb36e49e38c03f6cfb58cd4626f485ffa7;p=gwion.git :art: Set scope in fptr arg parsing --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 76bae39e..6bac630a 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -320,7 +320,12 @@ ANN m_bool scan1_fptr_def(const Env env, const Fptr_Def fptr) { } const Func_Def fdef = fptr->base->func->def; CHECK_OB((fdef->base->ret_type = scan1_type(env, fdef->base->td))) - return fdef->base->args ? scan1_args(env, fdef->base->args) : GW_OK; + if(!fdef->base->args) + return GW_OK; + ++env->scope->depth; + const m_bool ret = scan1_args(env, fdef->base->args); + --env->scope->depth; + return ret; } ANN m_bool scan1_type_def(const Env env, const Type_Def tdef) { diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 31698025..7e9bde94 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -73,8 +73,12 @@ ANN static Value scan2_func_assign(const Env env, const Func_Def d, ANN m_bool scan2_fptr_def(const Env env NUSED, const Fptr_Def fptr) { if(!tmpl_base(fptr->base->tmpl)) { const Func_Def def = fptr->type->e->d.func->def; - if(def->base->args) - CHECK_BB(scan2_args(def)) + if(def->base->args) { + ++env->scope->depth; + const m_bool ret = scan2_args(def); + --env->scope->depth; + return ret; + } } else SET_FLAG(fptr->type, func); return GW_OK;