diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-15 15:57:04 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-15 15:57:04 +0000 |
commit | 96923b7a14839e7505b194ab76e1f15bb88fa7ed (patch) | |
tree | 81ea9b6fd45875d67c735a49f08b9c26df6fe01d /src/vim9expr.c | |
parent | 1a572e9b3b497e0412b4001cd9c6859db0c35412 (diff) | |
download | vim-git-96923b7a14839e7505b194ab76e1f15bb88fa7ed.tar.gz |
patch 8.2.4573: a nested function is compiled for debugging without contextv8.2.4573
Problem: A nested function (closure) is compiled for debugging without
context.
Solution: Check if a nested function is marked for debugging before
compiling it. Give an error when trying to compile a closure
without its context. (closes #9951)
Diffstat (limited to 'src/vim9expr.c')
-rw-r--r-- | src/vim9expr.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vim9expr.c b/src/vim9expr.c index 19cd55d3c..e2e4f8e6a 100644 --- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -1007,6 +1007,14 @@ compile_lambda(char_u **arg, cctx_T *cctx) ) compile_def_function(ufunc, FALSE, CT_NONE, cctx); + // if the outer function is not compiled for debugging, this one might be + if (cctx->ctx_compile_type != CT_DEBUG) + { + update_has_breakpoint(ufunc); + if (COMPILE_TYPE(ufunc) == CT_DEBUG) + compile_def_function(ufunc, FALSE, CT_DEBUG, 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 // dangling pointer. |