]> Nishi Git Mirror - gwion.git/commitdiff
:art: Internal gack
authorfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 8 Oct 2019 14:13:33 +0000 (16:13 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 8 Oct 2019 14:13:33 +0000 (16:13 +0200)
src/emit/emit.c
tests/internal_op/internal_gack.gw [new file with mode: 0644]

index f2cba9f8817d067de27fe6c7b4dca2c211388553..9d2aaf15400d2017c72756887bb77c5f3c02ac02 100644 (file)
@@ -1767,8 +1767,10 @@ ANN static VM_Code emit_internal(const Emitter emit, const Func f) {
     emit->env->class_def->nspc->dtor = f->code = finalyze(emit, DTOR_EOC);
     ADD_REF(f->code)
     return f->code;
-  } else if(f->def->base->xid == insert_symbol("@gack"))
-    emit->env->class_def->e->gack = f->code;
+  } else if(f->def->base->xid == insert_symbol("@gack")) {
+    f->code = finalyze(emit, FuncReturn);
+    return emit->env->class_def->e->gack = f->code;
+  }
   return finalyze(emit, FuncReturn);
 }
 
diff --git a/tests/internal_op/internal_gack.gw b/tests/internal_op/internal_gack.gw
new file mode 100644 (file)
index 0000000..40f8fec
--- /dev/null
@@ -0,0 +1,5 @@
+class C {
+  operator @gack void() { <<< __func__ >>>; }
+}
+<<< C c >>>;
+<<< c >>>;