From: Jérémie Astor Date: Wed, 16 Dec 2020 23:48:39 +0000 (+0100) Subject: :art: Remove Dot.t_base X-Git-Tag: nightly~1099 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=984a9e0de9ed0a6692bf179be1b3573abeaa7969;p=gwion.git :art: Remove Dot.t_base --- diff --git a/ast b/ast index b648fbde..b3aba278 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit b648fbdea475b7f6bd86372c40f0d3876440b3fc +Subproject commit b3aba278f4602a02959f97f7ddee3813f3f2337e diff --git a/src/emit/emit.c b/src/emit/emit.c index b7143517..e8564449 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1868,7 +1868,7 @@ ANN static m_bool emit_stmt_list(const Emitter emit, Stmt_List l) { } 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); } diff --git a/src/lib/object_op.c b/src/lib/object_op.c index 7d2a0a35..b926e39b 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -101,7 +101,7 @@ ANN static void emit_member_func(const Emitter emit, const Exp_Dot* member) { 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; @@ -109,7 +109,7 @@ else // 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); @@ -144,8 +144,8 @@ ANN m_bool not_from_owner_class(const Env env, const Type t, const Value v, cons 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"), @@ -157,7 +157,7 @@ OP_CHECK(opck_object_dot) { 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]; } @@ -180,9 +180,9 @@ OP_CHECK(opck_object_dot) { 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)) diff --git a/src/lib/union.c b/src/lib/union.c index f5d059d3..d02f6ae1 100644 --- a/src/lib/union.c +++ b/src/lib/union.c @@ -35,11 +35,11 @@ ANN Instr emit_kind(Emitter emit, const m_uint size, const uint addr, const f_in 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; } @@ -75,7 +75,7 @@ static OP_CHECK(opck_union_is) { 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)); diff --git a/src/parse/check.c b/src/parse/check.c index 5f0ad35f..00a716b7 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -285,7 +285,7 @@ ANN static Value check_non_res_value(const Env env, const Symbol *data) { } 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); } @@ -843,7 +843,7 @@ ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) { } 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); }