diff src/vim9compile.c @ 28101:3bc0a639dfb0 v8.2.4575

patch 8.2.4575: Vim9: test for profiling still fails Commit: https://github.com/vim/vim/commit/139575de6653e7fd5807cb036dfb3684b815c519 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 15 19:29:30 2022 +0000 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Mar 2022 20:30:03 +0100
parents 632a84e2ce92
children dd2ed5345f20
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -913,8 +913,7 @@ compile_nested_function(exarg_T *eap, cc
 	}
     }
 
-    update_has_breakpoint(ufunc);
-    compile_type = COMPILE_TYPE(ufunc);
+    compile_type = get_compile_type(ufunc);
 #ifdef FEAT_PROFILE
     // If the outer function is profiled, also compile the nested function for
     // profiling.
@@ -2475,6 +2474,30 @@ check_args_shadowing(ufunc_T *ufunc, cct
     return r;
 }
 
+/*
+ * Get the compilation type that should be used for "ufunc".
+ * Keep in sync with INSTRUCTIONS().
+ */
+    compiletype_T
+get_compile_type(ufunc_T *ufunc)
+{
+    // Update uf_has_breakpoint if needed.
+    update_has_breakpoint(ufunc);
+
+    if (debug_break_level > 0 || may_break_in_function(ufunc))
+	return CT_DEBUG;
+#ifdef FEAT_PROFILE
+    if (do_profiling == PROF_YES)
+    {
+	if (!ufunc->uf_profiling && has_profiling(FALSE, ufunc->uf_name, NULL))
+	    func_do_profile(ufunc);
+	if (ufunc->uf_profiling)
+	    return CT_PROFILE;
+    }
+#endif
+    return CT_NONE;
+}
+
 
 /*
  * Add a function to the list of :def functions.