mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2164: Vim9: autoload function doesn't work in uppercased script
Problem: Vim9: autoload function doesn't work in script that starts with an upper case letter. Solution: Check for the autoload character. (closes #7502)
This commit is contained in:
parent
13656f02e4
commit
17f700ac8b
@ -2799,6 +2799,16 @@ def Test_vim9_autoload()
|
|||||||
g:some#other = 'other'
|
g:some#other = 'other'
|
||||||
assert_equal('other', g:some#other)
|
assert_equal('other', g:some#other)
|
||||||
|
|
||||||
|
# upper case script name works
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Other#getOther(): string
|
||||||
|
return 'other'
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
writefile(lines, 'Xdir/autoload/Other.vim')
|
||||||
|
assert_equal('other', g:Other#getOther())
|
||||||
|
|
||||||
delete('Xdir', 'rf')
|
delete('Xdir', 'rf')
|
||||||
&rtp = save_rtp
|
&rtp = save_rtp
|
||||||
enddef
|
enddef
|
||||||
|
@ -2654,8 +2654,18 @@ trans_function_name(
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In Vim9 script a user function is script-local by default.
|
// In Vim9 script a user function is script-local by default, unless it
|
||||||
|
// starts with a lower case character: dict.func().
|
||||||
vim9script = ASCII_ISUPPER(*start) && in_vim9script();
|
vim9script = ASCII_ISUPPER(*start) && in_vim9script();
|
||||||
|
if (vim9script)
|
||||||
|
{
|
||||||
|
char_u *p;
|
||||||
|
|
||||||
|
// SomeScript#func() is a global function.
|
||||||
|
for (p = start; *p != NUL && *p != '('; ++p)
|
||||||
|
if (*p == AUTOLOAD_CHAR)
|
||||||
|
vim9script = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the function name to allocated memory.
|
* Copy the function name to allocated memory.
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2164,
|
||||||
/**/
|
/**/
|
||||||
2163,
|
2163,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user