Patch 8.2.2316

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 8, 2021, 4:25:20 PM1/8/21
to vim...@googlegroups.com

Patch 8.2.2316
Problem: Vim9: cannot list a lambda function.
Solution: Support the <lambda>9 notation, like :disassemble. (closes #7634)
Files: src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2315/src/userfunc.c 2021-01-08 21:55:23.217365612 +0100
--- src/userfunc.c 2021-01-08 22:12:40.105897228 +0100
***************
*** 3094,3100 ****
}
else
{
! name = trans_function_name(&p, &is_global, eap->skip,
TFN_NO_AUTOLOAD, &fudi, NULL, NULL);
paren = (vim_strchr(p, '(') != NULL);
if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip)
--- 3094,3108 ----
}
else
{
! if (STRNCMP(p, "<lambda>", 8) == 0)
! {
! p += 8;
! (void)getdigits(&p);
! name = vim_strnsave(eap->arg, p - eap->arg);
! CLEAR_FIELD(fudi);
! }
! else
! name = trans_function_name(&p, &is_global, eap->skip,
TFN_NO_AUTOLOAD, &fudi, NULL, NULL);
paren = (vim_strchr(p, '(') != NULL);
if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip)
*** ../vim-8.2.2315/src/testdir/test_vim9_func.vim 2021-01-08 21:55:23.217365612 +0100
--- src/testdir/test_vim9_func.vim 2021-01-08 22:18:46.080741667 +0100
***************
*** 1802,1807 ****
--- 1802,1817 ----
Line_continuation_in_lambda()->assert_equal(['D', 'C', 'B', 'A'])
enddef

+ def Test_list_lambda()
+ timer_start(1000, (_) => 0)
+ var body = execute(timer_info()[0].callback
+ ->string()
+ ->substitute("('", ' ', '')
+ ->substitute("')", '', '')
+ ->substitute('function\zs', ' ', ''))
+ assert_match('def <lambda>\d\+(_: any, ...): number\n1 return 0\n enddef', body)
+ enddef
+
func Test_silent_echo()
CheckScreendump

*** ../vim-8.2.2315/src/version.c 2021-01-08 21:55:23.217365612 +0100
--- src/version.c 2021-01-08 22:24:00.939773267 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2316,
/**/

--
FIXME and XXX are two common keywords used to mark broken or incomplete code
not only since XXX as a sex reference would grab everybody's attention but
simply due to the fact that Vim would highlight these words.
-- Hendrik Scholz

/// 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