From d47acfb081ea70b71a477fb51d5438c700ac42aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 4 Jun 2020 13:35:10 +0200 Subject: [PATCH] :bug: Fix PushStatic Usage --- src/emit/emit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index 35310790..f44cca4d 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1046,8 +1046,16 @@ ANN Instr emit_exp_call1(const Emitter emit, const Func f) { back->m_val = 0; } } else if(emit->env->func != f && !f->value_ref->from->owner_class && !f->code && !is_fptr(emit->gwion, f->value_ref->type)) { - const Instr back = !GET_FLAG(f->def, op) ? emit_add_instr(emit, PushStaticCode) : (Instr)vector_back(&emit->code->instr); - back->m_val = (m_uint)f; + if(GET_FLAG(f->def, op)) { + const Instr back = (Instr)vector_back(&emit->code->instr); + back->m_val = (m_uint)f; + } else { +// ensure env? + CHECK_BO(emit_func_def(emit, f->def)) + const Instr instr = emit_add_instr(emit, RegSetImm); + instr->m_val = (m_uint)f->code; + instr->m_val2 = -SZ_INT; + } } } else if((f->value_ref->from->owner_class && is_special(emit, f->value_ref->from->owner_class) > 0) || !f->value_ref->from->owner_class || (GET_FLAG(f, template) && -- 2.43.0