patch 8.2.4575: Vim9: test for profiling still fails
Problem: Vim9: test for profiling still fails.
Solution: Update flags for profiling and breakpoints when obtaining the
compile type. Do not set the FC_CLOSURE flag for a toplevel
function.
diff --git a/src/vim9instr.c b/src/vim9instr.c
index 9b176df..de144dc 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1207,8 +1207,10 @@
cctx->ctx_has_closure = 1;
// If the referenced function is a closure, it may use items further up in
- // the nested context, including this one.
- if (ufunc->uf_flags & FC_CLOSURE)
+ // the nested context, including this one. But not a function defined at
+ // the script level.
+ if ((ufunc->uf_flags & FC_CLOSURE)
+ && func_name_refcount(cctx->ctx_ufunc->uf_name))
cctx->ctx_ufunc->uf_flags |= FC_CLOSURE;
type = ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type;
@@ -1487,6 +1489,7 @@
&& ufunc->uf_def_status != UF_COMPILE_ERROR)
{
int i;
+ compiletype_T compile_type;
for (i = 0; i < argcount; ++i)
{
@@ -1519,9 +1522,10 @@
return FAIL;
}
}
- if (func_needs_compiling(ufunc, COMPILE_TYPE(ufunc))
+ compile_type = get_compile_type(ufunc);
+ if (func_needs_compiling(ufunc, compile_type)
&& compile_def_function(ufunc, ufunc->uf_ret_type == NULL,
- COMPILE_TYPE(ufunc), NULL) == FAIL)
+ compile_type, NULL) == FAIL)
return FAIL;
}
if (ufunc->uf_def_status == UF_COMPILE_ERROR)