diff options
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 27 |
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. |