]> Nishi Git Mirror - gwion.git/commitdiff
:art: Make gack more dynamic
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 24 Feb 2020 23:35:15 +0000 (00:35 +0100)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 24 Feb 2020 23:35:15 +0000 (00:35 +0100)
src/lib/gack.c

index 1fd00ed0d08bb52e239e7d48cfd383263e6c189a..05bdecb8c3e49ab317855472dc7b79f8ef5f933d 100644 (file)
@@ -63,6 +63,11 @@ ANN static void prepare_call(const VM_Shred shred, m_uint offset) {
 
 ANN void gack(const VM_Shred shred, const Instr instr) {
   Type t = (Type)instr->m_val;
+  if(isa(t, shred->info->vm->gwion->type[et_object]) > 0 && !GET_FLAG(t, force)) {
+    const M_Object o = *(M_Object*)(shred->reg - SZ_INT);
+    if(o)
+      t = o->type_ref;
+  }
   const VM_Code code = get_gack(t);
   if(GET_FLAG(code, builtin)) {
     ((f_gack)code->native_func)(t, (shred->reg - t->size), shred);