Patch 8.2.3066
Problem: Vim9: debugging lambda does not work.
Solution: Use the compile type of the function when compiling a lambda.
(closes #8412)
Files: src/vim9compile.c, src/testdir/test_debugger.vim
*** ../vim-8.2.3065/src/vim9compile.c 2021-06-27 15:35:36.955403117 +0200
--- src/vim9compile.c 2021-06-27 16:28:26.819232754 +0200
***************
*** 3622,3628 ****
// 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);
// 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.
--- 3622,3628 ----
// compile_return().
if (ufunc->uf_ret_type->tt_type == VAR_VOID)
ufunc->uf_ret_type = &t_unknown;
! 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.
*** ../vim-8.2.3065/src/testdir/test_debugger.vim 2021-06-23
20:20:49.654780609 +0200
--- src/testdir/test_debugger.vim 2021-06-27 16:27:24.347373778 +0200
***************
*** 932,938 ****
call delete('Xtest2.vim')
endfunc
! func Test_debug_DefFunction()
CheckCWD
let file =<< trim END
vim9script
--- 932,938 ----
call delete('Xtest2.vim')
endfunc
! func Test_debug_def_and_legacy_function()
CheckCWD
let file =<< trim END
vim9script
***************
*** 1068,1073 ****
--- 1068,1100 ----
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
*** ../vim-8.2.3065/src/version.c 2021-06-27 15:35:36.955403117 +0200
--- src/version.c 2021-06-27 16:11:49.953135946 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3066,
/**/
--
Latest survey shows that 3 out of 4 people make up 75% of the
world's population.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202106271430.15REUHt4640735%40masaka.moolenaar.net.