mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4360: Vim9: allowing use of "s:" leads to inconsistencies
Problem: Vim9: allowing use of "s:" leads to inconsistencies. Solution: Disallow using "s:" in Vim9 script at the script level.
This commit is contained in:
14
src/eval.c
14
src/eval.c
@@ -878,6 +878,14 @@ get_lval(
|
||||
return lp->ll_name_end;
|
||||
}
|
||||
|
||||
// Cannot use "s:var" at the Vim9 script level. "s: type" is OK.
|
||||
if (in_vim9script() && at_script_level()
|
||||
&& name[0] == 's' && name[1] == ':' && !VIM_ISWHITE(name[2]))
|
||||
{
|
||||
semsg(_(e_cannot_use_s_colon_in_vim9_script_str), name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Find the end of the name.
|
||||
p = find_name_end(name, &expr_start, &expr_end, fne_flags);
|
||||
lp->ll_name_end = p;
|
||||
@@ -3732,6 +3740,12 @@ eval7(
|
||||
emsg(_(e_cannot_use_underscore_here));
|
||||
ret = FAIL;
|
||||
}
|
||||
else if (evaluate && in_vim9script() && len > 2
|
||||
&& s[0] == 's' && s[1] == ':')
|
||||
{
|
||||
semsg(_(e_cannot_use_s_colon_in_vim9_script_str), s);
|
||||
ret = FAIL;
|
||||
}
|
||||
else if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
|
||||
{
|
||||
// "name(..." recursive!
|
||||
|
Reference in New Issue
Block a user