Patch 8.2.3794
Problem:    Vim9: cannot find script-local func using "s:". (Yegappan
            Lakshmanan)
Solution:   Skip the "s:".
Files:      src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.3793/src/userfunc.c      2021-12-11 16:13:32.227721221 +0000
--- src/userfunc.c      2021-12-13 11:18:12.770638813 +0000
***************
*** 1885,1897 ****
      {
        char_u  *after_script = NULL;
        long    sid = 0;
!       int     find_script_local = in_vim9script()
!                                    && eval_isnamec1(*name) && name[1] != ':';
  
        if (find_script_local)
        {
            // Find script-local function before global one.
!           func = find_func_with_sid(name, current_sctx.sc_sid);
            if (func != NULL)
                return func;
        }
--- 1885,1898 ----
      {
        char_u  *after_script = NULL;
        long    sid = 0;
!       int     find_script_local = in_vim9script() && eval_isnamec1(*name)
!                                          && (name[1] != ':' || *name == 's');
  
        if (find_script_local)
        {
            // Find script-local function before global one.
!           func = find_func_with_sid(name[0] == 's' && name[1] == ':'
!                                      ? name + 2 : name, current_sctx.sc_sid);
            if (func != NULL)
                return func;
        }
*** ../vim-8.2.3793/src/testdir/test_vim9_func.vim      2021-12-12 
21:02:00.033298122 +0000
--- src/testdir/test_vim9_func.vim      2021-12-13 11:29:14.892786390 +0000
***************
*** 1243,1248 ****
--- 1243,1260 ----
    &operatorfunc = ''
  enddef
  
+ def Test_use_script_func_name_with_prefix()
+   var lines =<< trim END
+       vim9script
+       func s:Getit()
+         return 'it'
+       endfunc
+       var Fn = s:Getit
+       assert_equal('it', Fn())
+   END
+   CheckScriptSuccess(lines)
+ enddef
+ 
  def Test_lambda_type_allocated()
    # Check that unreferencing a partial using a lambda can use the variable 
type
    # after the lambda has been freed and does not leak memory.
*** ../vim-8.2.3793/src/version.c       2021-12-12 21:02:00.033298122 +0000
--- src/version.c       2021-12-13 11:25:57.825285201 +0000
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     3794,
  /**/

-- 
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems...            -- Tim Hammerquist

 /// 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/20211213113135.2212D1C0D95%40moolenaar.net.

Raspunde prin e-mail lui