From c9ac36b888aa9f8a3597d4fe79d99bc94e8a80a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 22 Sep 2021 19:27:49 +0200 Subject: [PATCH] :bug: More edge case fixes --- src/lib/object_op.c | 10 ++++++++-- src/parse/template.c | 2 +- src/vm/vm.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/object_op.c b/src/lib/object_op.c index e2353320..6a50adb5 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -144,8 +144,14 @@ ANN static void emit_member_func(const Emitter emit, const Exp_Dot *member) { if (!vflag(f->value_ref, vflag_member)) instr->m_val2 = -SZ_INT; else { - const Instr instr = emit_add_instr(emit, RegMove); - instr->m_val = SZ_INT; + if(member->is_call){ + const Instr instr = emit_add_instr(emit, RegMove); + instr->m_val = SZ_INT; + } else { + const Instr instr = (Instr)vector_back(&emit->code->instr); + instr->opcode = eRegPushImm; + instr->m_val = (m_uint)f->code; + } } } return; diff --git a/src/parse/template.c b/src/parse/template.c index 9419af4b..80e76556 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -18,7 +18,7 @@ ANN static m_bool _push_types(const Env env, const Nspc nspc, Type_List call = tmpl->call; do { if (!call) break; - const Type t = known_type(env, call->td); + const Type t = call->td ? known_type(env, call->td) : NULL; if (!t) return GW_OK; nspc_add_type(nspc, list->xid, t); call = call->next; diff --git a/src/vm/vm.c b/src/vm/vm.c index 8cbc14d3..96ba7e92 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -684,7 +684,7 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto] intlt: INT_LOGICAL(<) intle: - INT_IMM_LOGICAL(<=) + INT_LOGICAL(<=) intgtimm: INT_IMM_LOGICAL(>) intgeimm: -- 2.43.0