To: vim_dev@googlegroups.com Subject: Patch 8.2.3794 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@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 ///