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 -- [email protected] -- 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    ///

-- 
-- 
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/202101082125.108LPDfh973751%40masaka.moolenaar.net.

Raspunde prin e-mail lui