ANN Type type_decl_resolve(const Env, const Type_Decl*);
ANEW ANN m_str tl2str(const Env, const Type_List); // in type_decl.c
ANN m_bool compat_func(const __restrict__ Func_Def, const __restrict__ Func_Def);
-ANN Type known_type(const Env env, const Type_Decl*, const m_str);
+ANN Type known_type(const Env env, const Type_Decl*);
ANN m_bool env_access(const Env env, const ae_flag flag);
ANN void env_storage(const Env env, ae_flag* flag);
ANN2(1,2) void env_add_value(const Env, const m_str, const Type, const m_bool, void*);
#include "nspc.h"
#include "operator.h"
-ANN Type check_exp_call1(const Env, const Exp restrict,const Exp, const Exp);
+ANN Type check_exp_call1(const Env env, const Exp_Call *exp);
ANN m_bool emit_exp_spork(const Emitter, const Exp_Unary*);
static INSTR(assign_func) { GWDEBUG_EXE
static OP_CHECK(opck_func_call) {
Exp_Binary* bin = (Exp_Binary*)data;
- return check_exp_call1(env, bin->rhs, bin->lhs, bin->self);
+ Exp_Call call = { .func=bin->rhs, .args=bin->lhs, .self=bin->self };
+ return check_exp_call1(env, &call);
}
ANN static Type fptr_type(Exp_Binary* bin) {
"\tplease provide template types. eg: '<type1, type2, ...>'")
}
-ANN2(1,2,4) static Type check_exp_call_template(const Env env, const Exp restrict call,
- const restrict Exp args, const restrict Exp base) {
+ANN static Type check_exp_call_template(const Env env, const Exp_Call *exp) {
+ const Exp call = exp->func;
+ const Exp args = exp->args;
+ const Exp base = exp->self;
m_uint args_number = 0;
const Value value = nspc_lookup_value1(call->type->owner, insert_symbol(call->type->name));
CHECK_OO(value)
return GW_OK;
}
-ANN2(1,2) Type check_exp_call1(const Env env, const restrict Exp call,
- const restrict Exp args, restrict Exp base) { GWDEBUG_EXE
- CHECK_BO(check_exp_call1_check(env, call))
- if(GET_FLAG(call->type->d.func, ref)) {
- const Value value = call->type->d.func->value_ref;
+ANN Type check_exp_call1(const Env env, const Exp_Call *exp) {
+ CHECK_BO(check_exp_call1_check(env, exp->func))
+ if(GET_FLAG(exp->func->type->d.func, ref)) {
+ const Value value = exp->func->type->d.func->value_ref;
CHECK_BO(traverse_template(env, value->owner_class->def))
}
- if(args)
- CHECK_OO(check_exp(env, args))
- if(GET_FLAG(call->type, func))
- return check_exp_call_template(env, call, args, base);
- const Func func = find_func_match(env, call->type->d.func, args);
+ if(exp->args)
+ CHECK_OO(check_exp(env, exp->args))
+ if(GET_FLAG(exp->func->type, func))
+ return check_exp_call_template(env, exp);
+ const Func func = find_func_match(env, exp->func->type->d.func, exp->args);
if(!func)
- return function_alternative(call->type, args);
- if(base->exp_type == ae_exp_call)
- base->d.exp_call.m_func = func;
- else // if(base->exp_type == ae_exp_binary)
- base->d.exp_binary.func = func;
+ return function_alternative(exp->func->type, exp->args);
+ if(exp->self->exp_type == ae_exp_call)
+ exp->self->d.exp_call.m_func = func;
+ else // if(exp->self->exp_type == ae_exp_binary)
+ exp->self->d.exp_binary.func = func;
return func->def->ret_type;
}
CHECK_OO((exp->m_func = ret))
return ret->def->ret_type;
}
- return check_exp_call1(env, exp->func, exp->args, exp->self);
+ return check_exp_call1(env, exp);
}
ANN static inline m_bool check_exp_unary_spork1(const Env env, const Stmt code) {