}
ANN static m_bool emit_exp_dot(const Emitter emit, const Exp_Dot* member) {
- struct Op_Import opi = { .op=insert_symbol("@dot"), .lhs=member->t_base,
+ struct Op_Import opi = { .op=insert_symbol("@dot"), .lhs=member->base->info->type,
.rhs=exp_self(member)->info->type, .data=(uintptr_t)member, .pos=exp_self(member)->pos, .op_type=op_dot };
return op_emit(emit, &opi);
}
if(f->def->base->tmpl)
emit_add_instr(emit, DotTmplVal);
else
- if(is_class(emit->gwion, member->t_base) || member->base->exp_type == ae_exp_cast) {
+ if(is_class(emit->gwion, member->base->info->type) || member->base->exp_type == ae_exp_cast) {
const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
func_i->m_val = (m_uint)f->code ?: (m_uint)f;
return;
// if(f->def->base->tmpl)
// emit_add_instr(emit, DotTmplVal);
else {
- if(tflag(member->t_base, tflag_struct)) {
+ if(tflag(member->base->info->type, tflag_struct)) {
if(!GET_FLAG(f->def->base, static)) {
exp_setvar(member->base, 1);
emit_exp(emit, member->base);
OP_CHECK(opck_object_dot) {
const Exp_Dot *member = (Exp_Dot*)data;
const m_str str = s_name(member->xid);
- const m_bool base_static = is_class(env->gwion, member->t_base);
- const Type the_base = base_static ? member->t_base->info->base_type : member->t_base;
+ const m_bool base_static = is_class(env->gwion, member->base->info->type);
+ const Type the_base = base_static ? member->base->info->type->info->base_type : member->base->info->type;
// if(!the_base->nspc)
// ERR_N(member->base->pos,
// _("type '%s' does not have members - invalid use in dot expression of %s"),
if(!value) {
env_err(env, exp_self(member)->pos,
_("class '%s' has no member '%s'"), the_base->name, str);
- if(member->t_base->nspc)
+ if(member->base->info->type->nspc)
did_you_mean_type(the_base, str);
return env->gwion->type[et_error];
}
OP_EMIT(opem_object_dot) {
const Exp_Dot *member = (Exp_Dot*)data;
- const Type t_base = actual_type(emit->gwion, member->t_base);
+ const Type t_base = actual_type(emit->gwion, member->base->info->type);
const Value value = find_value(t_base, member->xid);
- if(!is_class(emit->gwion, member->t_base) && (vflag(value, vflag_member) ||
+ if(!is_class(emit->gwion, member->base->info->type) && (vflag(value, vflag_member) ||
(isa(exp_self(member)->info->type, emit->gwion->type[et_function]) > 0 &&
!is_fptr(emit->gwion, exp_self(member)->info->type)))) {
if(!tflag(t_base, tflag_struct))
static OP_EMIT(opem_union_dot) {
const Exp_Dot *member = (Exp_Dot*)data;
- const Map map = &member->t_base->nspc->info->value->map;
+ const Map map = &member->base->info->type->nspc->info->value->map;
CHECK_BB(emit_exp(emit, member->base))
if(isa(exp_self(member)->info->type, emit->gwion->type[et_function]) > 0) {
const Instr instr = emit_add_instr(emit, RegPushImm);
- const Func f = (Func)vector_front(&member->t_base->info->parent->nspc->info->vtable);
+ const Func f = (Func)vector_front(&member->base->info->type->info->parent->nspc->info->vtable);
instr->m_val = (m_uint)f->code;
return GW_OK;
}
const Exp exp = call->args;
if(exp->exp_type != ae_exp_primary && exp->d.prim.prim_type != ae_prim_id)
ERR_N(exp->pos, "Union.is() argument must be of form id");
- const Type t = call->func->d.exp_dot.t_base;
+ const Type t = call->func->d.exp_dot.base->info->type;
const Value v = find_value(t, exp->d.prim.d.var);
if(!v)
ERR_N(exp->pos, "'%s' has no member '%s'", t->name, s_name(exp->d.prim.d.var));
}
ANN static Type check_dot(const Env env, const Exp_Dot *member) {
- struct Op_Import opi = { .op=insert_symbol("@dot"), .lhs=member->t_base, .data=(uintptr_t)member,
+ struct Op_Import opi = { .op=insert_symbol("@dot"), .lhs=member->base->info->type, .data=(uintptr_t)member,
.pos=exp_self(member)->pos, .op_type=op_dot };
return op_check(env, &opi);
}
}
ANN static Type check_exp_dot(const Env env, Exp_Dot* member) {
- CHECK_OO((member->t_base = check_exp(env, member->base)))
+ CHECK_OO(check_exp(env, member->base))
return check_dot(env, member);
}