From: Jérémie Astor Date: Sun, 27 Jun 2021 09:28:58 +0000 (+0200) Subject: :art: Improve VM_Code->ret_type X-Git-Tag: nightly~569 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=36488057057b67be1a0f8cd96c2511135277b1e0;p=gwion.git :art: Improve VM_Code->ret_type --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 6cb5f5ef..73267799 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2569,6 +2569,7 @@ ANN static inline VM_Code _emit_func_def_code(const Emitter emit, ANN static VM_Code emit_func_def_code(const Emitter emit, const Func func) { const VM_Code code = _emit_func_def_code(emit, func); if (emit->info->memoize && fflag(func, fflag_pure)) code->is_memoize = true; + code->ret_type = func->def->base->ret_type; return code; } @@ -2672,7 +2673,6 @@ ANN m_bool emit_func_def(const Emitter emit, const Func_Def f) { const Func base = nspc_lookup_func1(func->value_ref->from->owner, f->base->xid); builtin_func(emit->gwion->mp, func, (f_xfun)base->code->native_func); - func->code->ret_type = fdef->base->ret_type; return GW_OK; } if (fdef_is_file_global(emit, fdef)) diff --git a/src/env/func.c b/src/env/func.c index 1073c5eb..591db4bd 100644 --- a/src/env/func.c +++ b/src/env/func.c @@ -39,4 +39,5 @@ ANN void builtin_func(const MemPool mp, const Func f, void *func_ptr) { set_vflag(f->value_ref, vflag_builtin); f->code = new_vmcode(mp, NULL, NULL, f->name, f->def->stack_depth, true); f->code->native_func = (m_uint)func_ptr; + f->code->ret_type = f->def->base->ret_type; }