ANN static Type check_exp_call(const Env env, Exp_Call* exp) {
if(exp->tmpl) {
CHECK_OO(check_exp(env, exp->func))
+ if(exp->args)
+ CHECK_OO(check_exp(env, exp->args))
const Type t = actual_type(env->gwion, unflag_type(exp->func->info->type));
if(isa(t, env->gwion->type[et_function]) < 0)
ERR_O(exp_self(exp)->pos, _("template call of non-function value."))
ERR_O(exp_self(exp)->pos, _("template call of non-template function."))
if(t->info->func->def->base->tmpl->call) {
if(env->func == t->info->func) {
- if(exp->args)
- CHECK_OO(check_exp(env, exp->args))
exp->m_func = env->func;
return env->func->def->base->ret_type;
} else
nspc_lookup_value1(v->from->owner, sym);
}
-ANN static m_bool check_call(const Env env, const Exp_Call* exp) {
- const ae_exp_t et = exp->func->exp_type;
- if(et != ae_exp_primary && et != ae_exp_dot && et != ae_exp_cast)
- ERR_B(exp->func->pos, _("invalid expression for function call."))
- CHECK_OB(check_exp(env, exp->func))
- if(exp->args)
- CHECK_OB(check_exp(env, exp->args))
- return GW_OK;
-}
-
ANN static inline m_bool tmpl_valid(const Env env, const Func_Def fdef) {
return safe_fflag(fdef->base->func, fflag_valid) ||
check_traverse_fdef(env, fdef) > 0;
}
ANN static Func _find_template_match(const Env env, const Value v, const Exp_Call* exp) {
- CHECK_BO(check_call(env, exp))
const Type_List types = exp->tmpl->call;
const Func former = env->func;
DECL_OO(const m_str, tmpl_name, = tl2str(env, types))
return m_func;
}
+ANN static inline m_bool check_call(const Env env, const Exp_Call* exp) {
+ const ae_exp_t et = exp->func->exp_type;
+ if(et != ae_exp_primary && et != ae_exp_dot && et != ae_exp_cast)
+ ERR_B(exp->func->pos, _("invalid expression for function call."))
+ return GW_OK;
+}
+
ANN Func find_template_match(const Env env, const Value value, const Exp_Call* exp) {
+ CHECK_BO(check_call(env, exp))
const Func f = _find_template_match(env, value, exp);
if(f)
return f;