From ad3d1e7e2414613775e85a204c52e66a066e8450 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Thu, 30 Jun 2022 00:58:50 +0200 Subject: [PATCH] :bug: Fix emit_call and union functions --- src/emit/emit.c | 6 ++---- src/lib/union.c | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index abc2f703..a322288f 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1616,12 +1616,10 @@ ANN m_bool emit_exp_call1(const Emitter emit, const Func f, else if (unlikely(!f->code && emit->env->func != f)) { if (tmpl) CHECK_BB(emit_template_code(emit, f)); else CHECK_BB(emit_ensure_func(emit, f)); - } else { - if(!f->value_ref->from->owner_class || + } else if(!f->value_ref->from->owner_class || GET_FLAG(f->value_ref->from->owner_class, final) || - GET_FLAG(f->value_ref->from->owner_class, static)) + GET_FLAG(f, static) || tmpl) push_func_code(emit, f); - } call_finish(emit, f, is_static); emit->status = status; return GW_OK; diff --git a/src/lib/union.c b/src/lib/union.c index 8bd38f19..0f2b2ea8 100644 --- a/src/lib/union.c +++ b/src/lib/union.c @@ -34,9 +34,7 @@ static OP_EMIT(opem_union_dot) { CHECK_BB(emit_exp(emit, member->base)); if (is_func(emit->gwion, exp_self(member)->type)) { // is_callable? can only be a func const Instr instr = emit_add_instr(emit, RegPushImm); - const Func f = - (Func)vector_front(&member->base->type->info->parent->nspc->vtable); - instr->m_val = (m_uint)f->code; + instr->m_val = (m_uint)exp_self(member)->type->info->func->code; return GW_OK; } if (!strcmp(s_name(member->xid), "index")) { @@ -190,7 +188,6 @@ ANN GWION_IMPORT(union) { .op = insert_symbol(gwi->gwion->st, "@func_check")}; CHECK_BB(add_op(gwi->gwion, &opi1)); -builtin_func(gwi->gwion->mp, f1, union_new); gwi->gwion->type[et_union] = t_union; GWI_BB(gwi_oper_ini(gwi, "union", (m_str)OP_ANY_TYPE, NULL)) -- 2.43.0