From 36488057057b67be1a0f8cd96c2511135277b1e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 27 Jun 2021 11:28:58 +0200 Subject: [PATCH] :art: Improve VM_Code->ret_type --- src/emit/emit.c | 2 +- src/env/func.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.43.0