From: fennecdjay Date: Fri, 23 Aug 2019 21:43:45 +0000 (+0200) Subject: :art: Add take_exp X-Git-Tag: nightly~2271 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3fcb00e4e715b9ec69433dd6c3117bd3e245a7e5;p=gwion.git :art: Add take_exp --- diff --git a/ast b/ast index 6aae98d6..5b97ea6d 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 6aae98d67c76592e25bdf74444f80e4a52e95bec +Subproject commit 5b97ea6d437d3fbbf5fb3eb138ce6357710cfcfc diff --git a/src/emit/emit.c b/src/emit/emit.c index a8cbef85..26dc49aa 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -407,12 +407,6 @@ ANN static inline m_bool emit_index(const Emitter emit, const Exp e) { return ret; } -static inline Exp take_exp(Exp e, m_uint n) { - for(m_uint i = 1; i < n; ++i) - CHECK_OO((e = e->next)) - return e; -} - ANN static void array_loop(const Emitter emit, const m_uint depth) { regpop(emit, depth * SZ_INT); emit_add_instr(emit, GWOP_EXCEPT); diff --git a/src/parse/check.c b/src/parse/check.c index 8f780625..1b6a6a57 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -358,12 +358,6 @@ ANN static Type check_exp_primary(const Env env, const Exp_Primary* primary) { return exp_self(primary)->type = prim_func[primary->primary_type](env, primary); } -static inline Exp take_exp(Exp e, m_uint n) { - for(m_uint i = 1; i < n; ++i) - CHECK_OO((e = e->next)) - return e; -} - ANN static Type at_depth(const Env env, const Array_Sub array); ANN static Type tuple_depth(const Env env, const Array_Sub array) { if(array->exp->exp_type != ae_exp_primary || @@ -519,6 +513,8 @@ ANN static inline Value template_get_ready(const Env env, const Value v, const m } static Func ensure_tmpl(const Env env, const Func_Def fdef, const Exp_Call *exp) { + if(fdef->base->func) + return fdef->base->func; const m_bool ret = traverse_func_def(env, fdef); if(ret > 0) { const Func f = fdef->base->func; @@ -590,7 +586,7 @@ CHECK_BO(check_call(env, exp)) m_func = env->func; break; } - if((m_func = ensure_tmpl(env, exists->d.func_ref->def, exp))) + if((m_func == exists->d.func_ref)) break; } else { const Value value = template_get_ready(env, v, "template", i);