Patch 8.2.1200

7 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 13, 2020, 12:19:01 PM7/13/20
to vim...@googlegroups.com

Patch 8.2.1200
Problem: Vim9: cannot disassemble a lambda function.
Solution: Recognize "<lambda>123" as a function name.
Files: src/vim9execute.c, src/testdir/test_vim9_disassemble.vim


*** ../vim-8.2.1199/src/vim9execute.c 2020-07-09 21:20:41.912126818 +0200
--- src/vim9execute.c 2020-07-13 18:09:49.357141350 +0200
***************
*** 2397,2403 ****
int prev_current = 0;
int is_global = FALSE;

! fname = trans_function_name(&arg, &is_global, FALSE,
TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL);
if (fname == NULL)
{
--- 2397,2410 ----
int prev_current = 0;
int is_global = FALSE;

! if (STRNCMP(arg, "<lambda>", 8) == 0)
! {
! arg += 8;
! (void)getdigits(&arg);
! fname = vim_strnsave(eap->arg, arg - eap->arg);
! }
! else
! fname = trans_function_name(&arg, &is_global, FALSE,
TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD, NULL, NULL);
if (fname == NULL)
{
*** ../vim-8.2.1199/src/testdir/test_vim9_disassemble.vim 2020-07-11 22:14:54.318422203 +0200
--- src/testdir/test_vim9_disassemble.vim 2020-07-13 18:16:54.731881547 +0200
***************
*** 664,669 ****
--- 664,682 ----
'\d PCALL (argc 1)\_s*' ..
'\d RETURN',
instr)
+
+ let name = substitute(instr, '.*\(<lambda>\d\+\).*', '\1', '')
+ instr = execute('disassemble ' .. name)
+ assert_match('<lambda>\d\+\_s*' ..
+ 'return "X" .. a .. "X"\_s*' ..
+ '\d PUSHS "X"\_s*' ..
+ '\d LOAD arg\[-1\]\_s*' ..
+ '\d 2STRING stack\[-1\]\_s*' ..
+ '\d CONCAT\_s*' ..
+ '\d PUSHS "X"\_s*' ..
+ '\d CONCAT\_s*' ..
+ '\d RETURN',
+ instr)
enddef

def AndOr(arg: any): string
*** ../vim-8.2.1199/src/version.c 2020-07-12 23:09:15.450213545 +0200
--- src/version.c 2020-07-13 18:08:17.757428912 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1200,
/**/

--
hundred-and-one symptoms of being an internet addict:
25. You believe nothing looks sexier than a man in boxer shorts illuminated
only by a 17" inch svga monitor.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages