From: Jérémie Astor Date: Tue, 15 Sep 2020 20:43:50 +0000 (+0200) Subject: :art: Add Func_Base flag X-Git-Tag: nightly~1295 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=949972918696e0c034050e6a018a8a7b1640738a;p=gwion.git :art: Add Func_Base flag --- diff --git a/ast b/ast index 0b64428e..4f6d18f2 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 0b64428ec56f99521ef33990cd0c725573b8418b +Subproject commit 4f6d18f266ba8c3fc3a8714e3abf043010f1afb6 diff --git a/src/import/import_fdef.c b/src/import/import_fdef.c index 34140c18..11828dc8 100644 --- a/src/import/import_fdef.c +++ b/src/import/import_fdef.c @@ -40,7 +40,7 @@ ANN Arg_List make_dll_arg_list(const Vector v) { ANEW ANN static Func_Base* gwi_func_base(const Gwi gwi, ImportCK *ck) { const Arg_List arg_list = make_dll_arg_list(&gwi->ck->v); - Func_Base *base = new_func_base(gwi->gwion->mp, ck->td, ck->sym, arg_list); + Func_Base *base = new_func_base(gwi->gwion->mp, ck->td, ck->sym, arg_list, ck->flag); ck->td = NULL; if(ck->tmpl) { base->tmpl = gwi_tmpl(gwi); diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 969388c7..a8c25978 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -36,12 +36,12 @@ ANN static inline m_bool scan0_defined(const Env env, const Symbol s, const loc_ ANN static void fptr_assign(const Env env, const Fptr_Def fptr) { const Func_Def def = fptr->type->e->d.func->def; - if(GET_FLAG(fptr->base->td, global)) { + if(GET_FLAG(fptr->base, global)) { context_global(env); SET_FLAG(fptr->value, global); SET_FLAG(fptr->base->func, global); SET_FLAG(def, global); - } else if(!GET_FLAG(fptr->base->td, static)) { + } else if(!GET_FLAG(fptr->base, static)) { SET_FLAG(fptr->value, member); SET_FLAG(fptr->base->func, member); SET_FLAG(def, member); @@ -59,7 +59,7 @@ ANN static void fptr_assign(const Env env, const Fptr_Def fptr) { static void fptr_def(const Env env, const Fptr_Def fptr) { const Func_Def def = new_func_def(env->gwion->mp, cpy_func_base(env->gwion->mp, fptr->base), - NULL, fptr->base->td->flag, loc_cpy(env->gwion->mp, td_pos(fptr->base->td))); + NULL, fptr->base->flag, loc_cpy(env->gwion->mp, td_pos(fptr->base->td))); fptr->base->func = new_func(env->gwion->mp, s_name(fptr->base->xid), def); fptr->value->d.func_ref = fptr->base->func; fptr->base->func->value_ref = fptr->value; @@ -68,17 +68,17 @@ static void fptr_def(const Env env, const Fptr_Def fptr) { } ANN m_bool scan0_fptr_def(const Env env, const Fptr_Def fptr) { - CHECK_BB(env_access(env, fptr->base->td->flag, td_pos(fptr->base->td))) + CHECK_BB(env_access(env, fptr->base->flag, td_pos(fptr->base->td))) CHECK_BB(scan0_defined(env, fptr->base->xid, td_pos(fptr->base->td))); const m_str name = s_name(fptr->base->xid); const Type t = scan0_type(env, env->gwion->type[et_fptr]->xid, name, env->gwion->type[et_fptr]); - t->e->owner = !(!env->class_def && GET_FLAG(fptr->base->td, global)) ? + t->e->owner = !(!env->class_def && GET_FLAG(fptr->base, global)) ? env->curr : env->global_nspc; t->e->owner_class = env->class_def; - if(GET_FLAG(fptr->base->td, global)) + if(GET_FLAG(fptr->base, global)) context_global(env); t->nspc = new_nspc(env->gwion->mp, name); - t->flag = fptr->base->td->flag; + t->flag = fptr->base->flag; fptr->type = t; fptr->value = mk_class(env, t); valuefrom(env, fptr->value->from);