Mercurial > vim
changeset 21747:7e1316c6d0eb v8.2.1423
patch 8.2.1423: Vim9: find global function when looking for script-local
Commit: https://github.com/vim/vim/commit/035d6e91bd83574cab5a913c5c3a924d9011696b
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 11 22:30:42 2020 +0200
patch 8.2.1423: Vim9: find global function when looking for script-local
Problem: Vim9: find global function when looking for script-local.
Solution: Don't strip prefix if name starts with "s:". (closes https://github.com/vim/vim/issues/6688)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Aug 2020 22:45:05 +0200 |
parents | b62f11358b97 |
children | d04be2bd54dc |
files | src/testdir/test_vim9_func.vim src/userfunc.c src/version.c |
diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -203,6 +203,15 @@ def Test_global_local_function() assert_equal('local', Func()) END CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + def g:Funcy() + echo 'funcy' + enddef + s:Funcy() + END + CheckScriptFailure(lines, 'E117:') enddef func TakesOneArg(arg)
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -2132,8 +2132,8 @@ call_func( char_u *p = untrans_function_name(rfname); // If using Vim9 script try not local to the script. - // TODO: should not do this if the name started with "s:". - if (p != NULL) + // Don't do this if the name starts with "s:". + if (p != NULL && (funcname[0] != 's' || funcname[1] != ':')) fp = find_func(p, is_global, NULL); }