From c5d972bb36e49e38c03f6cfb58cd4626f485ffa7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 12 May 2020 18:16:24 +0200 Subject: [PATCH] :art: Set scope in fptr arg parsing --- src/parse/scan1.c | 7 ++++++- src/parse/scan2.c | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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; -- 2.43.0