From 1759a68a4cb878278ff52af67f9e7c7f96866aea Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 8 Oct 2019 16:13:33 +0200 Subject: [PATCH] :art: Internal gack --- src/emit/emit.c | 6 ++++-- tests/internal_op/internal_gack.gw | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/internal_op/internal_gack.gw diff --git a/src/emit/emit.c b/src/emit/emit.c index f2cba9f8..9d2aaf15 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -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 index 00000000..40f8fecb --- /dev/null +++ b/tests/internal_op/internal_gack.gw @@ -0,0 +1,5 @@ +class C { + operator @gack void() { <<< __func__ >>>; } +} +<<< C c >>>; +<<< c >>>; -- 2.43.0