From 852983a88b8300650597d43b45d23de753f97d1b Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 5 Nov 2019 21:23:53 +0100 Subject: [PATCH] :art: gwi_tmpl --- include/gwi.h | 4 +++- include/import/special.h | 1 - src/import/fdef.c | 2 +- src/import/tdef.c | 2 +- src/import/udef.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/gwi.h b/include/gwi.h index a3630001..a24e0f1a 100644 --- a/include/gwi.h +++ b/include/gwi.h @@ -12,5 +12,7 @@ struct Gwi_ { }; #include "import/internals.h" - +static inline Tmpl* gwi_tmpl(const Gwi gwi) { + return new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1); +} #endif diff --git a/include/import/special.h b/include/import/special.h index de28ae0a..428a3f82 100644 --- a/include/import/special.h +++ b/include/import/special.h @@ -13,5 +13,4 @@ ANN void gwi_set_loc(const Gwi, const m_str, const uint); ANN Type_Decl* str2decl(const Gwi, const m_str); ANN Var_Decl str2var(const Gwi, const m_str); ANN Var_Decl_List str2varlist(const Gwi, const m_str); - #endif diff --git a/src/import/fdef.c b/src/import/fdef.c index dd3802a0..94c65b96 100644 --- a/src/import/fdef.c +++ b/src/import/fdef.c @@ -47,7 +47,7 @@ ANEW ANN static Func_Base* gwi_func_base(const Gwi gwi, ImportCK *ck) { Func_Base *base = new_func_base(gwi->gwion->mp, ck->td, ck->sym, arg_list); ck->td = NULL; if(ck->tmpl) { - base->tmpl = new_tmpl(gwi->gwion->mp, ck->tmpl, -1); + base->tmpl = gwi_tmpl(gwi); ck->tmpl = NULL; } return base; diff --git a/src/import/tdef.c b/src/import/tdef.c index 8f235f58..29a19d98 100644 --- a/src/import/tdef.c +++ b/src/import/tdef.c @@ -35,7 +35,7 @@ ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag) { td->flag |= flag; const Type_Def tdef = new_type_def(gwi->gwion->mp, td, gwi->ck->sym); if(gwi->ck->tmpl) - tdef->tmpl = new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1); + tdef->tmpl = gwi_tmpl(gwi); gwi->ck->td = NULL; gwi->ck->tmpl = NULL; const m_bool ret = traverse_type_def(gwi->gwion->env, tdef); diff --git a/src/import/udef.c b/src/import/udef.c index baa4c3f0..7a93bdcb 100644 --- a/src/import/udef.c +++ b/src/import/udef.c @@ -78,7 +78,7 @@ ANN Type gwi_union_end(const Gwi gwi, const ae_flag flag) { if(gwi->ck->tmpl) { if(udef->xid) GWI_ERR_O(_("Template union type can't declare instance at declaration")); - udef->tmpl = new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1); + udef->tmpl = gwi_tmpl(gwi); gwi->ck->tmpl = NULL; } const Type t = union_type(gwi, udef); -- 2.43.0