forked from aniani/vim
patch 8.2.2311: Vim9: cannot assign to variable that shadows command modifier
Problem: Vim9: cannot assign to a variable that shadows a command modifier. Solution: Check for assignment after possible command modifier. (closes #7632)
This commit is contained in:
@@ -2738,6 +2738,25 @@ parse_command_modifiers(
|
||||
}
|
||||
|
||||
p = skip_range(eap->cmd, TRUE, NULL);
|
||||
|
||||
// In Vim9 script a variable can shadow a command modifier:
|
||||
// verbose = 123
|
||||
// verbose += 123
|
||||
// silent! verbose = func()
|
||||
// verbose.member = 2
|
||||
// verbose[expr] = 2
|
||||
if (in_vim9script())
|
||||
{
|
||||
char_u *s;
|
||||
|
||||
for (s = p; ASCII_ISALPHA(*s); ++s)
|
||||
;
|
||||
s = skipwhite(s);
|
||||
if (vim_strchr((char_u *)".[=", *s) != NULL
|
||||
|| (*s != NUL && s[1] == '='))
|
||||
break;
|
||||
}
|
||||
|
||||
switch (*p)
|
||||
{
|
||||
// When adding an entry, also modify cmd_exists().
|
||||
|
Reference in New Issue
Block a user