Patch 8.2.3003
Problem: Vim9: closure compiled with wrong compile type.
Solution: Use COMPILE_TYPE() when calling a function. (closes #8384)
Files: src/vim9execute.c, src/testdir/test_debugger.vim
*** ../vim-8.2.3002/src/vim9execute.c 2021-06-14 20:40:33.590233925 +0200
--- src/vim9execute.c 2021-06-15 19:32:01.546617566 +0200
***************
*** 752,763 ****
int error;
int idx;
int did_emsg_before = did_emsg;
! compiletype_T compile_type = CT_NONE;
- #ifdef FEAT_PROFILE
- if (do_profiling == PROF_YES && ufunc->uf_profiling)
- compile_type = CT_PROFILE;
- #endif
if (func_needs_compiling(ufunc, compile_type)
&& compile_def_function(ufunc, FALSE, compile_type, NULL)
== FAIL)
--- 752,759 ----
int error;
int idx;
int did_emsg_before = did_emsg;
! compiletype_T compile_type = COMPILE_TYPE(ufunc);
if (func_needs_compiling(ufunc, compile_type)
&& compile_def_function(ufunc, FALSE, compile_type, NULL)
== FAIL)
*** ../vim-8.2.3002/src/testdir/test_debugger.vim 2021-06-14 20:40:33.590233925 +0200
--- src/testdir/test_debugger.vim 2021-06-15 19:31:19.450742289 +0200
***************
*** 932,937 ****
--- 932,964 ----
call delete('Xtest2.vim')
endfunc
+ func Test_debug_def_function()
+ CheckCWD
+ let file =<< trim END
+ vim9script
+ def g:Func()
+ var n: number
+ def Closure(): number
+ return n + 3
+ enddef
+ n += Closure()
+ echo 'result: ' .. n
+ enddef
+ END
+ call writefile(file, 'Xtest.vim')
+
+ let buf = RunVimInTerminal('-S Xtest.vim', {})
+
+ call RunDbgCmd(buf,
+ \ ':debug call Func()',
+ \ ['cmd: call Func()'])
+ call RunDbgCmd(buf, 'next', ['result: 3'])
+ call term_sendkeys(buf, "\r")
+
+ call StopVimInTerminal(buf)
+ call delete('Xtest.vim')
+ endfunc
+
func Test_debug_backtrace_level()
CheckCWD
let lines =<< trim END
*** ../vim-8.2.3002/src/version.c 2021-06-15 19:09:20.778539956 +0200
--- src/version.c 2021-06-15 19:22:56.384224331 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 3003,
/**/
--
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///