comparison src/vim9compile.c @ 25222:fbb530e081ca v8.2.3147

patch 8.2.3147: Vim9: profiling does not work with a nested function Commit: https://github.com/vim/vim/commit/648594eaf703fe9a862cb12a35702a10aff6e5a9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 11 17:55:01 2021 +0200 patch 8.2.3147: Vim9: profiling does not work with a nested function Problem: Vim9: profiling does not work with a nested function. Solution: Also compile a nested function without profiling. (closes https://github.com/vim/vim/issues/8543) Handle that compiling may cause the table of compiled functions to change.
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Jul 2021 18:00:04 +0200
parents 218df177cff8
children 10a5eb15a3bf
comparison
equal deleted inserted replaced
25221:7bff292bff66 25222:fbb530e081ca
3622 // compile_return(). 3622 // compile_return().
3623 if (ufunc->uf_ret_type->tt_type == VAR_VOID) 3623 if (ufunc->uf_ret_type->tt_type == VAR_VOID)
3624 ufunc->uf_ret_type = &t_unknown; 3624 ufunc->uf_ret_type = &t_unknown;
3625 compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx); 3625 compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx);
3626 3626
3627 #ifdef FEAT_PROFILE
3627 // When the outer function is compiled for profiling, the lambda may be 3628 // When the outer function is compiled for profiling, the lambda may be
3628 // called without profiling. Compile it here in the right context. 3629 // called without profiling. Compile it here in the right context.
3629 if (cctx->ctx_compile_type == CT_PROFILE) 3630 if (cctx->ctx_compile_type == CT_PROFILE)
3630 compile_def_function(ufunc, FALSE, CT_NONE, cctx); 3631 compile_def_function(ufunc, FALSE, CT_NONE, cctx);
3632 #endif
3631 3633
3632 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" 3634 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg"
3633 // points into it. Point to the original line to avoid a dangling pointer. 3635 // points into it. Point to the original line to avoid a dangling pointer.
3634 if (evalarg.eval_tofree_cmdline != NULL) 3636 if (evalarg.eval_tofree_cmdline != NULL)
3635 { 3637 {
5628 == FAIL) 5630 == FAIL)
5629 { 5631 {
5630 func_ptr_unref(ufunc); 5632 func_ptr_unref(ufunc);
5631 goto theend; 5633 goto theend;
5632 } 5634 }
5635
5636 #ifdef FEAT_PROFILE
5637 // When the outer function is compiled for profiling, the nested function
5638 // may be called without profiling. Compile it here in the right context.
5639 if (COMPILE_TYPE(ufunc) == CT_PROFILE
5640 && func_needs_compiling(ufunc, CT_NONE))
5641 compile_def_function(ufunc, FALSE, CT_NONE, cctx);
5642 #endif
5633 5643
5634 if (is_global) 5644 if (is_global)
5635 { 5645 {
5636 char_u *func_name = vim_strnsave(name_start + 2, 5646 char_u *func_name = vim_strnsave(name_start + 2,
5637 name_end - name_start - 2); 5647 name_end - name_start - 2);