-Subproject commit 0edd66928516857b57cd1a8878197bb84eb6a08c
+Subproject commit 2a5fcf44783a6bba322e4fa8586b1d78137203b9
ANN static Func predefined_func(const Env env, const Value v,
Exp_Call *exp, const Tmpl *tm) {
Tmpl tmpl = { .call=tm->call };
- ((Exp_Call*)exp)->tmpl = &tmpl;
+ exp->tmpl = &tmpl;
DECL_OO(const Func, func, = get_template_func(env, exp, v))
return v->d.func_ref = func;
}
-ANN static Type check_exp_call_template(const Env env, const Exp_Call *exp) {
+ANN static Type check_exp_call_template(const Env env, Exp_Call *exp) {
const Exp call = exp->func;
const Exp args = exp->args;
DECL_OO(const Value, value, = nspc_lookup_value1(call->type->e->owner, insert_symbol(call->type->name)))
CHECK_BO(traverse_func_def(env, func->def))
env_pop(env, scope);
}
- ((Exp_Call*)exp)->m_func = func;
+ exp->m_func = func;
return func->def->base->ret_type;
}
m_uint args_number = 0;
if(exp->args)
CHECK_OO(check_exp(env, exp->args))
if(GET_FLAG(exp->func->type, func))
- return check_exp_call_template(env, exp);
+ return check_exp_call_template(env, (Exp_Call*)exp);
const Func func = find_func_match(env, exp->func->type->e->d.func, exp->args);
return (exp_self(exp)->d.exp_call.m_func = func) ?
func->def->base->ret_type : function_alternative(env, exp->func->type, exp->args, exp_self(exp)->pos);
return already_defined(env, s, pos);
}
+
+ANN static void fptr_assign(const Env env, const Fptr_Def fptr) {
+ const Func_Def def = fptr->type->e->d.func->def;
+ if(GET_FLAG(fptr->base->td, global)) {
+ SET_FLAG(fptr->value, global);
+ SET_FLAG(fptr->base->func, global);
+ SET_FLAG(def, global);
+ } else if(!GET_FLAG(fptr->base->td, static)) {
+ SET_FLAG(fptr->value, member);
+ SET_FLAG(fptr->base->func, member);
+ SET_FLAG(def, member);
+ def->stack_depth += SZ_INT;
+ } else {
+ SET_FLAG(fptr->value, static);
+ SET_FLAG(fptr->base->func, static);
+ SET_FLAG(def, static);
+ }
+ if(GET_FLAG(def, variadic))
+ def->stack_depth += SZ_INT;
+ fptr->value->owner_class = env->class_def;
+}
+
static void fptr_def(const Env env, const Fptr_Def fptr) {
const Func_Def def = new_func_def(env->gwion->mp, new_func_base(env->gwion->mp, fptr->base->td, fptr->base->xid, fptr->base->args),
NULL,fptr->base->td->flag, loc_cpy(env->gwion->mp, td_pos(fptr->base->td)));
ERR_O(td_pos(td), _("cannot declare variables of size '0' (i.e. 'void')..."))
}
-
ANN static inline Type get_base_type(const Env env, const Type t) {
const m_str decl_name = get_type_name(env, t->name, 0);
return nspc_lookup_type1(env->curr, insert_symbol(decl_name));
}
ANN m_bool scan1_class_def(const Env env, const Class_Def cdef) {
- if(!cdef->base.type)
- CHECK_BB(scan0_class_def(env, cdef))
if(tmpl_base(cdef->base.tmpl))
return GW_OK;
SET_FLAG(cdef->base.type, scan1);
}
-ANN void fptr_assign(const Env env, const Fptr_Def fptr) {
- const Func_Def def = fptr->type->e->d.func->def;
- if(GET_FLAG(fptr->base->td, global)) {
- SET_FLAG(fptr->value, global);
- SET_FLAG(fptr->base->func, global);
- SET_FLAG(def, global);
- } else if(!GET_FLAG(fptr->base->td, static)) {
- SET_FLAG(fptr->value, member);
- SET_FLAG(fptr->base->func, member);
- SET_FLAG(def, member);
- def->stack_depth += SZ_INT;
- } else {
- SET_FLAG(fptr->value, static);
- SET_FLAG(fptr->base->func, static);
- SET_FLAG(def, static);
- }
- if(GET_FLAG(def, variadic))
- def->stack_depth += SZ_INT;
- fptr->value->owner_class = env->class_def;
-}
-
ANN m_bool scan2_fptr_def(const Env env, const Fptr_Def fptr) {
const Func_Def def = fptr->type->e->d.func->def;
if(!tmpl_base(fptr->base->tmpl)) {