From: fennecdjay Date: Wed, 14 Aug 2019 23:40:30 +0000 (+0200) Subject: :art: Reduce some function lookup scope X-Git-Tag: nightly~2286 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=30eba167e9ca261c4236ee33faaf0063a7f33b47;p=gwion.git :art: Reduce some function lookup scope --- diff --git a/src/lib/instr.c b/src/lib/instr.c index 13ffed02..b42b75f2 100644 --- a/src/lib/instr.c +++ b/src/lib/instr.c @@ -77,7 +77,7 @@ INSTR(GTmpl) { for(m_uint i = 0 ; i <= f->value_ref->offset; ++i) { const Symbol sym = func_symbol(emit->env, f->value_ref->owner->name, name, tmpl_name, i); - const Func base = nspc_lookup_func1(f->value_ref->owner, sym); + const Func base = nspc_lookup_func0(f->value_ref->owner, sym); if(base) { free_mstr(emit->gwion->mp, tmpl_name); assert(base->code); @@ -107,7 +107,7 @@ INSTR(DotTmpl) { char str[instr->m_val2 + strlen(t->name) + 1]; strcpy(str, name); strcpy(str + instr->m_val2, t->name); - const Func f = nspc_lookup_func1(t->nspc, insert_symbol(emit->env->gwion->st, str)); + const Func f = nspc_lookup_func0(t->nspc, insert_symbol(emit->env->gwion->st, str)); if(f) { *(VM_Code*)shred->reg = f->code; shred->reg += SZ_INT; diff --git a/src/parse/func.c b/src/parse/func.c index 2d3ce42c..702fa447 100644 --- a/src/parse/func.c +++ b/src/parse/func.c @@ -41,7 +41,7 @@ ANN Func get_func(const Env env, const Func_Def def) { char c[len + elen + 1]; memcpy(c, f->name, len); strcpy(c + len, env->class_def->name); - return nspc_lookup_func1(env->class_def->nspc, insert_symbol(env->gwion->st, c)); + return nspc_lookup_func0(env->class_def->nspc, insert_symbol(env->gwion->st, c)); } return f; } diff --git a/src/parse/scan2.c b/src/parse/scan2.c index ca970270..2e765c88 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -459,7 +459,7 @@ ANN static m_str template_helper(const Env env, const Func_Def f) { const m_str name = f->base->func ? f->base->func->name : func_tmpl_name(env, f); if(!name) return(m_str)GW_ERROR; - const Func func = nspc_lookup_func1(env->curr, insert_symbol(name)); + const Func func = nspc_lookup_func0(env->curr, insert_symbol(name)); if(func) { f->base->ret_type = known_type(env, f->base->td); return (m_str)(m_uint)((f->base->args && f->base->args->type) ? scan2_args(env, f) : GW_OK);