summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-10 16:55:58 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-10 16:55:58 +0000
commit9fffef9f3562e05755e4b3c46509b2eeeb623ff7 (patch)
treecb16a0a914ba937887e7801dd2b436a71de39bfe /src/vim9compile.c
parentb711814cb64b60ec4918e3e1fb2ca5c50d6e9340 (diff)
downloadvim-git-9fffef9f3562e05755e4b3c46509b2eeeb623ff7.tar.gz
patch 8.2.3775: Vim9: lambda compiled without outer context when debuggingv8.2.3775
Problem: Vim9: lambda compiled without outer context when debugging. Solution: When compiling a lambda for debugging also compile it without. (closes #9302)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index cde56ac20..a75219e0a 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3762,12 +3762,15 @@ compile_lambda(char_u **arg, cctx_T *cctx)
ufunc->uf_ret_type = &t_unknown;
compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx);
+ // When the outer function is compiled for profiling or debugging, the
+ // lambda may be called without profiling or debugging. Compile it here in
+ // the right context.
+ if (cctx->ctx_compile_type == CT_DEBUG
#ifdef FEAT_PROFILE
- // When the outer function is compiled for profiling, the lambda may be
- // called without profiling. Compile it here in the right context.
- if (cctx->ctx_compile_type == CT_PROFILE)
- compile_def_function(ufunc, FALSE, CT_NONE, cctx);
+ || cctx->ctx_compile_type == CT_PROFILE
#endif
+ )
+ compile_def_function(ufunc, FALSE, CT_NONE, cctx);
// The last entry in evalarg.eval_tofree_ga is a copy of the last line and
// "*arg" may point into it. Point into the original line to avoid a