ANN2(1, 2)
Symbol func_symbol(const Env, const m_str, const m_str, const m_str,
const m_uint);
-ANN m_bool check_lambda(const Env, const Type, Exp_Lambda *);
ANN Type check_op_call(const Env env, Exp_Call *const exp);
ANN void builtin_func(const Gwion gwion, const Func f, void *func_ptr);
}
}
-ANN static m_bool fptr_tmpl_push(const Env env, struct FptrInfo *info) {
- if (!info->rhs->def->base->tmpl) return GW_OK;
+ANN static bool fptr_tmpl_push(const Env env, struct FptrInfo *info) {
+ if (!info->rhs->def->base->tmpl) return true;
nspc_push_type(env->gwion->mp, env->curr);
_fptr_tmpl_push(env, info->rhs);
- return GW_OK;
+ return true;
}
-static m_bool td_match(const Env env, Type_Decl *id[2]) {
- DECL_OB(const Type, t0, = known_type(env, id[0]));
- DECL_OB(const Type, t1, = known_type(env, id[1]));
- if (isa(t0, t1) > 0) return GW_OK;
- return t1 == env->gwion->type[et_auto] ? GW_OK : GW_ERROR;
+static bool td_match(const Env env, Type_Decl *id[2]) {
+ DECL_B(const Type, t0, = known_type(env, id[0]));
+ DECL_B(const Type, t1, = known_type(env, id[1]));
+ if (isa(t0, t1) > 0) return true;
+ return t1 == env->gwion->type[et_auto];
}
-ANN static m_bool fptr_args(const Env env, Func_Base *base[2]) {
+ANN static bool fptr_args(const Env env, Func_Base *base[2]) {
Arg_List args0 = base[0]->args, args1 = base[1]->args;
const bool member = vflag(base[0]->func->value_ref, vflag_member);
const uint32_t len0 = mp_vector_len(args0) + member;
const uint32_t len1 = mp_vector_len(args1);
- if(len0 != len1) return GW_ERROR;
+ if(len0 != len1) return false;
if(member) {
const Arg *arg = mp_vector_at(args1, Arg, 0);
- CHECK_BB(isa(base[0]->func->value_ref->from->owner_class, arg->type));
+ CHECK_B(isa(base[0]->func->value_ref->from->owner_class, arg->type));
}
for(uint32_t i = member; i < len0; i++) {
const Arg *arg0 = mp_vector_at(args0, Arg, (i - member));
const Arg *arg1 = mp_vector_at(args1, Arg, i);
if (arg0->type && arg1->type)
- CHECK_BB(isa(arg0->type, arg1->type));
+ CHECK_B(isa(arg0->type, arg1->type));
else if(!tmpl_base(base[0]->tmpl) && !tmpl_base(base[1]->tmpl)){
Type_Decl *td[2] = {arg0->var.td, arg1->var.td};
- CHECK_BB(td_match(env, td));
+ CHECK_B(td_match(env, td));
}
}
- return GW_OK;
+ return true;
}
ANN static bool fptr_effects(const Env env, struct FptrInfo *info) {
return true;
}
-ANN static m_bool fptr_check(const Env env, struct FptrInfo *info) {
+ANN static bool fptr_check(const Env env, struct FptrInfo *info) {
// if(!info->lhs->def->base->tmpl != !info->rhs->def->base->tmpl)
// return GW_ERROR;
if(!info->lhs)
- ERR_B(info->exp->loc,
+ ERR_b(info->exp->loc,
_("can't resolve operator"))
- return GW_OK;
+ return true;
}
-ANN static inline m_bool fptr_rettype(const Env env, struct FptrInfo *info) {
+ANN static inline bool fptr_rettype(const Env env, struct FptrInfo *info) {
Type_Decl *td[2] = {info->lhs->def->base->td, info->rhs->def->base->td};
return td_match(env, td);
}
}
Type type = NULL;
Func_Base *base[2] = {info->lhs->def->base, info->rhs->def->base};
- CHECK_BO(fptr_tmpl_push(env, info));
- if (fptr_rettype(env, info) > 0 &&
- fptr_args(env, base) > 0 && fptr_effects(env, info))
+ CHECK_O(fptr_tmpl_push(env, info));
+ if (fptr_rettype(env, info) &&
+ fptr_args(env, base) && fptr_effects(env, info))
type = actual_type(env->gwion, info->lhs->value_ref->type)
?: info->lhs->value_ref->type;
if (info->rhs->def->base->tmpl) nspc_pop_type(env->gwion->mp, env->curr);
return NULL;
}
-ANN static m_bool _check_lambda(const Env env, Exp_Lambda *l,
+#undef ERR_B
+#define ERR_B(a, b, ...) \
+ { \
+ env_err(env, (a), (b), ##__VA_ARGS__); \
+ return false; \
+ }
+
+ANN static bool _check_lambda(const Env env, Exp_Lambda *l,
const Func_Def fdef) {
Arg_List bases = fdef->base->args;
Arg_List args = l->def->base->args;
Capture *cap = mp_vector_at(l->def->captures, Capture, i);
const Value v = nspc_lookup_value1(env->curr, cap->var.tag.sym);
if(!v) ERR_B(cap->var.tag.loc, _("unknown value in capture"));
- DECL_OB(const Type, t, = upvalue_type(env, cap));
+ DECL_B(const Type, t, = upvalue_type(env, cap));
cap->temp = new_value(env, t, cap->var.tag);
cap->var.value = v;
}
for(uint32_t i = 0; i < bases->len; i++) {
Arg *base = mp_vector_at(bases, Arg, i);
Arg *arg = mp_vector_at(args, Arg, i);
- DECL_OB(const Type, arg_type, = known_type(env, base->var.td));
+ DECL_B(const Type, arg_type, = known_type(env, base->var.td));
arg->var.td = type2td(env->gwion, arg_type, exp_self(l)->loc);
}
}
- DECL_OB(const Type, ret_type, = known_type(env, fdef->base->td));
+ DECL_B(const Type, ret_type, = known_type(env, fdef->base->td));
l->def->base->td = type2td(env->gwion, ret_type, exp_self(l)->loc);
/*Type*/ owner = fdef->base->func->value_ref->from->owner_class;
return ret;
}
-ANN m_bool check_lambda(const Env env, const Type t, Exp_Lambda *l) {
+ANN static bool check_lambda(const Env env, const Type t, Exp_Lambda *l) {
const Func_Def fdef = t->info->func->def;
- CHECK_BB(_check_lambda(env, l, fdef));
+ CHECK_B(_check_lambda(env, l, fdef));
exp_self(l)->type = l->def->base->func->value_ref->type;
- return GW_OK;
+ return true;
}
-ANN static m_bool fptr_do(const Env env, struct FptrInfo *info) {
+ANN static bool fptr_do(const Env env, struct FptrInfo *info) {
if(info->exp->type->info->func) {
- CHECK_BB(fptr_check(env, info));
+ CHECK_B(fptr_check(env, info));
if (!(info->exp->type = fptr_type(env, info)))
- ERR_B(info->exp->loc, _("no match found"))
- return GW_OK;
+ ERR_b(info->exp->loc, _("no match found"))
+ return true;
}
Exp_Lambda *l = &info->exp->d.exp_lambda;
return check_lambda(env, actual_type(env->gwion, info->rhs->value_ref->type), l);
struct FptrInfo info = {.lhs = bin->lhs->type->info->func,
.rhs = rhs->base->func,
.exp = bin->lhs};
- CHECK_BN(fptr_do(env, &info));
+ CHECK_ON(fptr_do(env, &info));
return bin->rhs->type;
}
struct FptrInfo info = {.lhs = impl->e->type->info->func,
.rhs = f,
.exp = impl->e};
- CHECK_BN(fptr_do(env, &info));
+ CHECK_ON(fptr_do(env, &info));
return impl->t;
}
struct FptrInfo info = {.lhs = cast->exp->type->info->func,
.rhs = f,
.exp = cast->exp};
- CHECK_BN(fptr_do(env, &info));
+ CHECK_ON(fptr_do(env, &info));
return t;
}
env_set_error(env, true);
}
}
-static m_bool op_call_narg(const Env env, Exp* arg, const loc_t loc) {
+static bool op_call_narg(const Env env, Exp* arg, const loc_t loc) {
m_uint narg = 0;
while (arg) {
narg++;
arg = arg->next;
}
- if (narg == 2) return GW_OK;
+ if (narg == 2) return true;
op_narg_err(env, NULL, loc);
- return GW_ERROR;
+ return false;
}
ANN Type check_op_call(const Env env, Exp_Call *const exp) {
- CHECK_BO(op_call_narg(env, exp->args, exp->func->loc));
+ CHECK_O(op_call_narg(env, exp->args, exp->func->loc));
Exp* base = exp_self(exp);
Exp* op_exp = exp->func;
base->exp_type = ae_exp_binary;
return check_exp(env, base);
}
-static m_bool op_impl_narg(const Env env, const Func_Def fdef,
+static bool op_impl_narg(const Env env, const Func_Def fdef,
const loc_t loc) {
- if (mp_vector_len(fdef->base->args) == 2) return GW_OK;
+ if (mp_vector_len(fdef->base->args) == 2) return true;
op_narg_err(env, fdef, loc);
- return GW_ERROR;
+ return false;
}
static inline void op_impl_ensure_types(const Env env, const Func func) {
static OP_CHECK(opck_op_impl) {
struct Implicit *impl = (struct Implicit *)data;
const Func func = closure_def(impl->t)->base->func;
- CHECK_BN(op_impl_narg(env, func->def, impl->e->loc));
+ CHECK_ON(op_impl_narg(env, func->def, impl->e->loc));
op_impl_ensure_types(env, func);
const Symbol lhs_sym = insert_symbol("@lhs");
const Symbol rhs_sym = insert_symbol("@rhs");
// or better, some function with envset and traverse
const m_uint scope = env_push(env, NULL, opi.nspc);
// we assume succes here
- /*const m_bool ret = */ traverse_func_def(env, def);
+ /*const bool ret = */ traverse_func_def(env, def);
env_pop(env, scope);
def->base->func->value_ref->type->info->parent = env->gwion->type[et_op];
impl->e->type = def->base->func->value_ref->type;
ANN Type check_exp_decl(const Env env, Exp_Decl *const decl) {
if (decl->var.td->array && decl->var.td->array->exp)
- CHECK_OO(check_exp(env, decl->var.td->array->exp));
+ CHECK_O(check_exp(env, decl->var.td->array->exp));
if (decl->args) {
Exp* e = new_exp_unary2(env->gwion->mp, insert_symbol("new"), cpy_type_decl(env->gwion->mp, decl->var.td), decl->args, decl->var.td->tag.loc);
- CHECK_OO(check_exp(env, e));
+ CHECK_O(check_exp(env, e));
decl->args = e;
e->ref = exp_self(decl);
}
Exp* e = array->exp;
if (!e)
ERR_O(prim_pos(data), _("must provide values/expressions for array [...]"))
- CHECK_OO(check_exp(env, e));
+ CHECK_O(check_exp(env, e));
env_weight(env, 1);
return array->type = prim_array_match(env, e);
}
ANN static Type check_prim_dict(const Env env, Exp* *data) {
Exp* base = *data;
- CHECK_OO(check_exp(env, base));
+ CHECK_O(check_exp(env, base));
const Type key = base->type;
const Type val = base->next->type;
bool err = false;
}
}
if (env->func && env->func->def->base->values) {
- DECL_OO(const Value, v, = upvalues_lookup(env->func->def->base->values, sym));
+ DECL_O(const Value, v, = upvalues_lookup(env->func->def->base->values, sym));
if(fbflag(env->func->def->base, fbflag_lambda))
- CHECK_OO(not_upvalue(env, v));
+ CHECK_O(not_upvalue(env, v));
return v;
}
return NULL;
}
ANN static Type check_prim_interp(const Env env, Exp* *exp) {
- CHECK_OO(check_exp(env, *exp));
+ CHECK_O(check_exp(env, *exp));
env_weight(env, 1);
return env->gwion->type[et_string];
}
ANN static Type check_prim_hack(const Env env, Exp* *data) {
if (env->func) unset_fflag(env->func, fflag_pure);
- CHECK_OO(check_prim_interp(env, data));
+ CHECK_O(check_prim_interp(env, data));
env_weight(env, 1);
return env->gwion->type[et_gack];
}
}
static ANN Type check_exp_array(const Env env, const Exp_Array *array) {
- CHECK_OO((array->array->type = check_exp(env, array->base)));
+ CHECK_O((array->array->type = check_exp(env, array->base)));
CHECK_O(check_subscripts(env, array->array, 0));
if(exp_getmeta(array->base)) exp_setmeta(exp_self(array), true);
return check_array_access(env, array->array);
}
static ANN Type check_exp_slice(const Env env, const Exp_Slice *range) {
- CHECK_OO(check_exp(env, range->base));
+ CHECK_O(check_exp(env, range->base));
CHECK_O(check_range(env, range->range));
env_weight(env, 1);
const Symbol sym = insert_symbol("[:]");
return NULL;
Arg *arg = i < args_len ? mp_vector_at(args, Arg, i++) : NULL;
if (!arg) {
- CHECK_OO(func->next);
+ CHECK_O(func->next);
return find_func_match_actual(env, func->next, exp, implicit,
specific);
}
if (owner) CHECK_O(template_push(env, owner));
arg->type = known_type(env, arg->var.td);
if (owner) nspc_pop_type(env->gwion->mp, env->curr);
- CHECK_OO(arg->type);
+ CHECK_O(arg->type);
}
if (!func_match_inner(env, e, arg->type, implicit, specific)) break;
call->func->d.prim.d.var = call->func->d.exp_dot.xid;
call->func->exp_type = ae_exp_primary;
call->func->d.prim.prim_type = ae_prim_id;
- CHECK_OO(check_exp_call(env, call));
+ CHECK_O(check_exp_call(env, call));
return call->func->type->info->func;
}
const Tmpl *tm) {
Tmpl tmpl = {.call = tm->call};
exp->tmpl = &tmpl;
- DECL_OO(const Func, func, = get_template_func(env, exp, v));
+ DECL_O(const Func, func, = get_template_func(env, exp, v));
return v->d.func_ref = func;
}
ANN static Type check_predefined(const Env env, Exp_Call *exp, const Value v,
const Tmpl *tm, const Func_Def fdef) {
- DECL_OO(const Func, func,
+ DECL_O(const Func, func,
= v->d.func_ref ?: predefined_func(env, v, exp, tm));
if (!fdef->base->ret_type) { // template fptr
struct EnvSet es = {.env = env,
for(uint32_t i = 0; i < len; i++) {
Specialized *spec = mp_vector_at(sl, Specialized, i);
if (tmplarg_match(env, spec->tag.sym, fdef->base->td->tag.sym, fdef->base->ret_type)) {
- CHECK_OO(check_exp(env, exp->other));
+ CHECK_O(check_exp(env, exp->other));
if(!is_func(env->gwion, exp->other->type)) {
TmplArg targ = {
.type = tmplarg_td,
const Func_Def fdef = closure_def(t);
t = fdef->base->func->value_ref->type;
}
- DECL_OO(const Value, value, = type_value(env->gwion, t));
+ DECL_O(const Value, value, = type_value(env->gwion, t));
const Func_Def fdef =
value->d.func_ref ? value->d.func_ref->def : t->info->func->def;
Tmpl *tm = fdef->base->tmpl;
if (tm->call) return check_predefined(env, exp, value, tm, fdef);
- DECL_OO(const TmplArg_List, tl, = check_template_args(env, exp, tm, fdef));
+ DECL_O(const TmplArg_List, tl, = check_template_args(env, exp, tm, fdef));
Tmpl tmpl = {.call = tl};
((Exp_Call *)exp)->tmpl = &tmpl;
- DECL_OO(const Func, func, = get_template_func(env, exp, value));
+ DECL_O(const Func, func, = get_template_func(env, exp, value));
return func->def->base->ret_type != env->gwion->type[et_auto] ?
func->def->base->ret_type : exp->func->d.exp_dot.base->type;
}
}
ANN Type _check_exp_call1(const Env env, Exp_Call *const exp) {
- DECL_OO(const Type, t, = call_type(env, exp));
+ DECL_O(const Type, t, = call_type(env, exp));
if (t == env->gwion->type[et_op]) return check_op_call(env, exp);
if (!t->info->func) // TODO: effects?
return check_lambda_call(env, exp);
if (exp->args) {
- CHECK_OO(check_exp(env, exp->args));
+ CHECK_O(check_exp(env, exp->args));
Exp* e = exp->args;
do exp_setuse(e, true);
while((e = e->next));
CHECK_O(func_check(env, exp, &mod));
if (mod) return exp_self(exp)->type;
const Type t = exp->func->type;
- CHECK_OO(check_static(env, exp->func));
+ CHECK_O(check_static(env, exp->func));
const Type _ret = _check_exp_call1(env, exp);
if(_ret) return _ret;
if(isa(exp->func->type, env->gwion->type[et_closure]) > 0) {
ANN static Type check_exp_binary(const Env env, const Exp_Binary *bin) {
if(bin->lhs->exp_type == ae_exp_call && !bin->lhs->d.exp_call.tmpl) {
- CHECK_OO(check_exp(env, bin->lhs->d.exp_call.func));
+ CHECK_O(check_exp(env, bin->lhs->d.exp_call.func));
// check is template?
bin->lhs->d.exp_call.other = bin->rhs;
}
- CHECK_OO(check_exp(env, bin->lhs));
+ CHECK_O(check_exp(env, bin->lhs));
const bool is_auto = //bin->op == insert_symbol(":=>") &&
bin->rhs->exp_type == ae_exp_decl &&
bin->rhs->d.exp_decl.type == env->gwion->type[et_auto];
}
if(bin->rhs->exp_type == ae_exp_call && !bin->rhs->d.exp_call.tmpl)
bin->rhs->d.exp_call.other = bin->lhs;
- CHECK_OO(check_exp(env, bin->rhs));
+ CHECK_O(check_exp(env, bin->rhs));
if (is_auto) {
assert(bin->rhs->type == bin->lhs->type);
set_vflag(bin->rhs->d.exp_decl.var.vd.value, vflag_assigned);
}
ANN static Type check_exp_cast(const Env env, const Exp_Cast *cast) {
- DECL_OO(const Type, t, = check_exp(env, cast->exp));
- CHECK_OO((exp_self(cast)->type = known_type(env, cast->td)));
+ DECL_O(const Type, t, = check_exp(env, cast->exp));
+ CHECK_O((exp_self(cast)->type = known_type(env, cast->td)));
struct Op_Import opi = {.op = insert_symbol("$"),
.lhs = t,
.rhs = exp_self(cast)->type,
.lhs = check_exp(env, post->exp),
.data = (uintptr_t)post,
.loc = exp_self(post)->loc};
- CHECK_OO(opi.lhs);
+ CHECK_O(opi.lhs);
exp_setuse(post->exp, 1);
const Type t = op_check(env, &opi);
if (t && isa(t, env->gwion->type[et_object]) < 0)
}
ANN static Type check_exp_call_tmpl(const Env env, Exp_Call *exp, const Type t) {
- if (exp->args) CHECK_OO(check_exp(env, exp->args));
+ if (exp->args) CHECK_O(check_exp(env, exp->args));
if (!t->info->func->def->base->tmpl)
ERR_O(exp_self(exp)->loc, _("template call of non-template function."))
if (t->info->func->def->base->tmpl->call) {
}
}
const Value v = type_value(env->gwion, t);
- DECL_OO(const Func, f, = find_template_match(env, v, exp));
+ DECL_O(const Func, f, = find_template_match(env, v, exp));
exp->func->type = f->value_ref->type;
return f->def->base->ret_type;
}
ANN static Type check_exp_call(const Env env, Exp_Call *exp) {
if (is_partial(env, exp->args)) {
- CHECK_OO(check_exp(env, exp->func));
+ CHECK_O(check_exp(env, exp->func));
struct Op_Import opi = {.op = insert_symbol("@partial"),
.lhs = exp->func->type,
.loc = exp->func->loc,
const Type rhs =
unary->unary_type == unary_exp ? check_exp(env, unary->exp) : NULL;
if (unary->unary_type == unary_exp) {
- CHECK_OO(rhs);
+ CHECK_O(rhs);
exp_setuse(unary->exp, 1);
}
struct Op_Import opi = {.op = unary->op,
.rhs = rhs,
.data = (uintptr_t)unary,
.loc = exp_self(unary)->loc};
- DECL_OO(const Type, ret, = op_check(env, &opi));
+ DECL_O(const Type, ret, = op_check(env, &opi));
return ret;
}
ANN static Type _flow(const Env env, Exp* e, const bool b) {
- DECL_OO(const Type, type, = check_exp(env, e));
+ DECL_O(const Type, type, = check_exp(env, e));
struct Op_Import opi = {
.op = insert_symbol(b ? "@conditional" : "@unconditional"),
.rhs = type,
scan1_exp(env, e);
scan2_exp(env, e);
}
- DECL_OO(const Type, cond, = check_flow(env, exp_if->cond));
- DECL_OO(const Type, if_exp, = check_exp(env, exp_if->if_exp));
- DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp));
+ DECL_O(const Type, cond, = check_flow(env, exp_if->cond));
+ DECL_O(const Type, if_exp, = check_exp(env, exp_if->if_exp));
+ DECL_O(const Type, else_exp, = check_exp(env, exp_if->else_exp));
const uint meta =
exp_getmeta(exp_if->if_exp) || exp_getmeta(exp_if->else_exp);
}
ANN static Type check_exp_dot(const Env env, Exp_Dot *member) {
- CHECK_OO(check_exp(env, member->base));
+ CHECK_O(check_exp(env, member->base));
return check_dot(env, member);
}
}
ANN static Type check_exp_td(const Env env, Type_Decl **td) {
- DECL_OO(const Type, t, = known_type(env, *td));
+ DECL_O(const Type, t, = known_type(env, *td));
if(t == env->gwion->type[et_class])
ERR_O(exp_self(td)->loc, "can't use {G+}Class{0} in type decl expression");
if (!is_func(env->gwion, t)) return type_class(env->gwion, t);
.data = (m_uint)exp,
.loc = idx->var.tag.loc
};
- DECL_OB(const Type, t, = op_check(env, &opi));
+ DECL_B(const Type, t, = op_check(env, &opi));
check_idx(env, t, idx);
return GW_OK;
}
CHECK_B(check_exp(env, stmt->exp));
if (stmt->idx)
CHECK_B(check_each_idx(env, stmt->exp, stmt->idx));
- DECL_OB(const Type, ret, = check_each_val(env, stmt->exp));
+ DECL_B(const Type, ret, = check_each_val(env, stmt->exp));
stmt->var.value = new_value(env, ret, stmt->tag);
valid_value(env, stmt->tag.sym, stmt->var.value);
return check_conts(env, stmt_self(stmt), stmt->body);
_("'return' statement inside constructor function should have no expression"))
return GW_OK;
}
- DECL_OB(const Type, ret_type,
+ DECL_B(const Type, ret_type,
= stmt->val ? check_exp(env, stmt->val) : env->gwion->type[et_void]);
if (!env->func->def->base->ret_type) {
env->func->def->base->ret_type = ret_type;
if (tmpl_base(fdef->base->tmpl)) return GW_OK;
Value override = NULL;
CHECK_B(check_func_def_override(env, fdef, &override));
- DECL_BB(const m_int, scope, = GET_FLAG(fdef->base, global)
+ const m_int scope = GET_FLAG(fdef->base, global)
? env_push_global(env)
- : env->scope->depth);
+ : env->scope->depth;
const Func former = env->func;
env->func = func;
nspc_push_value(env->gwion->mp, env->curr);
ANN static Func create_tmpl(const Env env, struct ResolverArgs *ra,
const m_uint i) {
- DECL_OO(const Value, value, = template_get_ready(env, ra->v, "template", i));
+ DECL_O(const Value, value, = template_get_ready(env, ra->v, "template", i));
if (value->d.func_ref->def->builtin) set_vflag(value, vflag_builtin);
const Func_Def fdef = cpy_func_def(env->gwion->mp, value->d.func_ref->def);
fdef->base->tmpl->call = cpy_tmplarg_list(env->gwion->mp, ra->types);
ANN static Func __find_template_match(const Env env, const Value v,
Exp_Call *const exp) {
- DECL_OO(const m_str, tmpl_name,
+ DECL_O(const m_str, tmpl_name,
= tl2str(env->gwion, exp->tmpl->call, exp->func->loc));
const Func f = find_tmpl(env, v, exp, tmpl_name);
free_mstr(env->gwion->mp, tmpl_name);
ANN static Func _find_template_match(const Env env, const Value v,
Exp_Call *const exp) {
- DECL_OO(const Func, f, = __find_template_match(env, v, exp));
+ DECL_O(const Func, f, = __find_template_match(env, v, exp));
TmplArg_List tl = exp->tmpl->call;
Specialized_List sl = f->def->base->tmpl->list;
for(uint32_t i = 0; i < tl->len; i++) {
// check argument in call exp?
continue;
}
- DECL_OO(const Type, t, = known_type(env, arg.d.td));
+ DECL_O(const Type, t, = known_type(env, arg.d.td));
if(t->info->traits && miss_traits(t, spec))
return NULL;
}
e->next = NULL;
const Type ret = check_exp(env, e);
e->next = next;
- CHECK_OO(ret);
+ CHECK_O(ret);
} else
- CHECK_OO((e->type = known_type(env, e->d.exp_cast.td)));
+ CHECK_O((e->type = known_type(env, e->d.exp_cast.td)));
if (!func_match_inner(env, e, arg->type, implicit, specific)) break;
}
e = e->next;
}
static ANN Type scan_func(const Env env, const Type t, const Type_Decl *td) {
- DECL_OO(const m_str, tl_name, = tl2str(env->gwion, td->types, td->tag.loc));
+ DECL_O(const m_str, tl_name, = tl2str(env->gwion, td->types, td->tag.loc));
const Symbol sym = func_symbol(env, t->info->value->from->owner->name,
t->info->func->name, tl_name, 0);
free_mstr(env->gwion->mp, tl_name);
if (td->next) {
Type_Decl *next = td->next;
td->next = NULL;
- DECL_OO(const Type, maybe_array, = known_type(env, td));
+ DECL_O(const Type, maybe_array, = known_type(env, td));
const Type owner = array_base_simple(maybe_array);
td->next = next;
- CHECK_OO(owner);
+ CHECK_O(owner);
if (!owner->nspc) ERR_O(td->tag.loc, "type '%s' has no namespace", owner->name)
struct EnvSet es = {.env = env,
.data = env,
GwText text;
text_init(&text, env->gwion->mp);
text_add(&text, "(");
- DECL_OO(const Type, t, = known_type(env, base->td));
- DECL_OO(const m_str, name, = type2str(env->gwion, t, base->td->tag.loc));
+ DECL_O(const Type, t, = known_type(env, base->td));
+ DECL_O(const m_str, name, = type2str(env->gwion, t, base->td->tag.loc));
text_add(&text, name);
free_mstr(env->gwion->mp, name);
text_add(&text, "(");
for(uint32_t i = 0; i < base->args->len; i++) {
if(i) text_add(&text, ",");
Arg *arg = mp_vector_at(base->args, Arg, i);
- DECL_OO(const Type, t, = known_type(env, arg->var.td));
- DECL_OO(const m_str, name, = type2str(env->gwion, t, arg->var.td->tag.loc));
+ DECL_O(const Type, t, = known_type(env, arg->var.td));
+ DECL_O(const m_str, name, = type2str(env->gwion, t, arg->var.td->tag.loc));
text_add(&text, name);
free_mstr(env->gwion->mp, name);
if(*global)
ANN static inline Type find(const Env env, Type_Decl *td) {
if (!td->fptr) return find_type(env, td);
bool global = false;
- CHECK_OO((td->tag.sym = symname(env, td->fptr->base, &global)));
+ CHECK_O((td->tag.sym = symname(env, td->fptr->base, &global)));
const Fptr_Def fptr = td->fptr;
td->fptr = NULL;
const Type exists = find_type(env, td);
ANN static Type resolve(const Env env, Type_Decl *td) {
Type_Decl *last = td;
while (last->next) last = last->next;
- DECL_OO(const Type, base, = find(env, td));
+ DECL_O(const Type, base, = find(env, td));
const Context ctx = base->info->value->from->ctx;
if (ctx && ctx->error) ERR_O(td->tag.loc, _("type '%s' is invalid"), base->name)
- DECL_OO(const Type, type, = find1(env, base, td));
- DECL_OO(const Type, t, = !td->ref ? type : ref(env, td));
- DECL_OO(const Type, ret, = !td->option ? t : option(env, td));
+ DECL_O(const Type, type, = find1(env, base, td));
+ DECL_O(const Type, t, = !td->ref ? type : ref(env, td));
+ DECL_O(const Type, ret, = !td->option ? t : option(env, td));
const Array_Sub array = last->array;
return !array ? ret : array_type(env, ret, array->depth, td->tag.loc);
}