1
0
forked from aniani/vim

patch 8.2.2673: Vim9: script-local funcref can have lower case name

Problem:    Vim9: script-local funcref can have lower case name.
Solution:   Require an upper case name.
This commit is contained in:
Bram Moolenaar
2021-03-28 21:14:06 +02:00
parent b2cb6c8bbd
commit 3215466af9
3 changed files with 32 additions and 2 deletions

View File

@@ -3453,8 +3453,10 @@ var_wrong_func_name(
char_u *name, // points to start of variable name
int new_var) // TRUE when creating the variable
{
// Allow for w: b: s: and t:.
if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':')
// Allow for w: b: s: and t:. In Vim9 script s: is not allowed, because
// the name can be used without the s: prefix.
if (!((vim_strchr((char_u *)"wbt", name[0]) != NULL
|| (!in_vim9script() && name[0] == 's')) && name[1] == ':')
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
? name[2] : name[0]))
{