]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Fix non emitted static func
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 26 May 2020 00:53:15 +0000 (02:53 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 26 May 2020 00:53:15 +0000 (02:53 +0200)
src/emit/emit.c

index 4938106f504958a7839956d171148118a86056bf..208657900689dd91b2af77102b92b9753d358458 100644 (file)
@@ -1064,6 +1064,13 @@ ANN Instr emit_exp_call1(const Emitter emit, const Func f) {
     const Instr instr = emit_add_instr(emit, (f_instr)(m_uint)exec);
     instr->m_val = val;
     instr->m_val2 = val2;
+  } else if(f->value_ref->from->owner_class && f != emit->env->func && !f->code&& ! is_fptr(emit->gwion, f->value_ref->type)){
+    /* not yet emitted static func */
+    const Instr instr = (Instr)vector_back(&emit->code->instr);
+    assert(instr->opcode == ePushStaticCode);
+    instr->opcode = eRegPushImm;
+    const Instr pushcode = emit_add_instr(emit, PushStaticCode);
+    pushcode->m_val = (m_uint)f;
   }
   const m_uint offset = emit_code_offset(emit);
   regseti(emit, offset);