Skip to content

Commit 035d6e9

Browse files
committed
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 #6688)
1 parent 097148e commit 035d6e9

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/testdir/test_vim9_func.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ def Test_global_local_function()
203203
assert_equal('local', Func())
204204
END
205205
CheckScriptSuccess(lines)
206+
207+
lines =<< trim END
208+
vim9script
209+
def g:Funcy()
210+
echo 'funcy'
211+
enddef
212+
s:Funcy()
213+
END
214+
CheckScriptFailure(lines, 'E117:')
206215
enddef
207216

208217
func TakesOneArg(arg)

src/userfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,8 +2132,8 @@ call_func(
21322132
char_u *p = untrans_function_name(rfname);
21332133

21342134
// If using Vim9 script try not local to the script.
2135-
// TODO: should not do this if the name started with "s:".
2136-
if (p != NULL)
2135+
// Don't do this if the name starts with "s:".
2136+
if (p != NULL && (funcname[0] != 's' || funcname[1] != ':'))
21372137
fp = find_func(p, is_global, NULL);
21382138
}
21392139

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1423,
757759
/**/
758760
1422,
759761
/**/

0 commit comments

Comments
 (0)