vim-patch:9.0.0355: check for uppercase char in autoload name is wrong

Problem:    Check for uppercase char in autoload name is wrong, it checks the
            name of the script.
Solution:   Remove the check. (closes vim/vim#11031)

6c667bdc94

Co-authored-by: thinca <thinca@gmail.com>
This commit is contained in:
zeertzjq
2022-11-06 15:11:48 +08:00
parent 7404c6010d
commit ed01ef7fa5
2 changed files with 7 additions and 2 deletions

View File

@@ -1453,9 +1453,10 @@ bool var_wrong_func_name(const char *const name, const bool new_var)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
// Allow for w: b: s: and t:.
// Allow autoload variable.
if (!(vim_strchr("wbst", name[0]) != NULL && name[1] == ':')
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
? name[2] : name[0])) {
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])
&& vim_strchr(name, '#') == NULL) {
semsg(_("E704: Funcref variable name must start with a capital: %s"), name);
return true;
}