diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-27 16:29:53 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-27 16:29:53 +0200 |
commit | 17d868b8b268c9b9670421039d1a772341937add (patch) | |
tree | 9b8c82e16646c8a7244e8dfb337fbfe06ab938dc | |
parent | 577dc93da9ec78684576bff71328d40f24bd6dd8 (diff) | |
download | vim-git-17d868b8b268c9b9670421039d1a772341937add.tar.gz |
patch 8.2.3066: Vim9: debugging lambda does not workv8.2.3066
Problem: Vim9: debugging lambda does not work.
Solution: Use the compile type of the function when compiling a lambda.
(closes #8412)
-rw-r--r-- | src/testdir/test_debugger.vim | 29 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 2 |
3 files changed, 31 insertions, 2 deletions
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim index 4601319f8..dbf200046 100644 --- a/src/testdir/test_debugger.vim +++ b/src/testdir/test_debugger.vim @@ -932,7 +932,7 @@ func Test_Backtrace_DefFunction() call delete('Xtest2.vim') endfunc -func Test_debug_DefFunction() +func Test_debug_def_and_legacy_function() CheckCWD let file =<< trim END vim9script @@ -1068,6 +1068,33 @@ func Test_debug_def_function() call delete('Xtest.vim') endfunc +func Test_debug_def_function_with_lambda() + CheckCWD + let lines =<< trim END + vim9script + def g:Func() + var s = 'a' + ['b']->map((_, v) => s) + echo "done" + enddef + breakadd func 2 g:Func + END + call writefile(lines, 'XtestLambda.vim') + + let buf = RunVimInTerminal('-S XtestLambda.vim', {}) + + call RunDbgCmd(buf, + \ ':call g:Func()', + \ ['function Func', 'line 2: [''b'']->map((_, v) => s)']) + call RunDbgCmd(buf, + \ 'next', + \ ['function Func', 'line 3: echo "done"']) + + call RunDbgCmd(buf, 'cont') + call StopVimInTerminal(buf) + call delete('XtestLambda.vim') +endfunc + func Test_debug_backtrace_level() CheckCWD let lines =<< trim END diff --git a/src/version.c b/src/version.c index d07a32085..9bb7c4f98 100644 --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3066, +/**/ 3065, /**/ 3064, diff --git a/src/vim9compile.c b/src/vim9compile.c index e746ea9d3..c5758cc18 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3622,7 +3622,7 @@ compile_lambda(char_u **arg, cctx_T *cctx) // compile_return(). if (ufunc->uf_ret_type->tt_type == VAR_VOID) ufunc->uf_ret_type = &t_unknown; - compile_def_function(ufunc, FALSE, COMPILE_TYPE(ufunc), cctx); + compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx); // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" // points into it. Point to the original line to avoid a dangling pointer. |