From: Jérémie Astor Date: Tue, 30 Jun 2020 21:25:57 +0000 (+0200) Subject: :art: Improve lambda_valid + cosmetics X-Git-Tag: nightly~1459 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=eafbfb979dddf22fc7147492902cf9869e889c0e;p=gwion.git :art: Improve lambda_valid + cosmetics --- diff --git a/src/parse/check.c b/src/parse/check.c index 922813d5..ce2941cf 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -294,7 +294,7 @@ ANN static inline m_bool lambda_valid(const Env env, const Exp_Primary* exp) { const m_uint scope = map_get(&env->curr->info->value->map, (m_uint)env->func->def->base) + 1; if((val != (Value)map_get((Map)vector_back(vec), xid) && !nspc_lookup_value1(env->global_nspc, sym) && val != (Value)map_get((Map)vector_at(vec, vector_size(vec) - scope), xid)) && - val->from->owner_class != env->class_def) + (val->from->owner_class && val->from->owner_class != env->class_def)) ERR_B(exp_self(exp)->pos, _("variable '%s' is not in lambda scope"), val->name) return GW_OK; } @@ -875,9 +875,8 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { } else CHECK_BO(predefined_call(env, t, exp_self(exp)->pos)) } - const Func ret = find_template_match(env, v, exp); - CHECK_OO((exp->m_func = ret)) - return ret->def->base->ret_type; + CHECK_OO((exp->m_func = find_template_match(env, v, exp))) + return exp->m_func->def->base->ret_type; } return check_exp_call1(env, exp); }