summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-15 19:29:30 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-15 19:29:30 +0000
commit139575de6653e7fd5807cb036dfb3684b815c519 (patch)
tree55a74125f139573cb1839c3b78cac73d3640f82c /src/vim9compile.c
parent48f69cdfa401999ac5ff8cef6d8dcabe3f93e284 (diff)
downloadvim-git-139575de6653e7fd5807cb036dfb3684b815c519.tar.gz
patch 8.2.4575: Vim9: test for profiling still failsv8.2.4575
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.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index d8119c566..fa5f067f5 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -913,8 +913,7 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx, garray_T *lines_to_free)
}
}
- 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, cctx_T *cctx)
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.