mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.2250: Vim9: sublist is ambiguous
Problem: Vim9: sublist is ambiguous. Solution: Require white space around the colon. (closes #7409)
This commit is contained in:
17
src/eval.c
17
src/eval.c
@@ -3725,6 +3725,7 @@ eval_index(
|
||||
int range = FALSE;
|
||||
char_u *key = NULL;
|
||||
int keylen = -1;
|
||||
int vim9 = in_vim9script();
|
||||
|
||||
if (check_can_index(rettv, evaluate, verbose) == FAIL)
|
||||
return FAIL;
|
||||
@@ -3755,6 +3756,12 @@ eval_index(
|
||||
empty1 = TRUE;
|
||||
else if (eval1(arg, &var1, evalarg) == FAIL) // recursive!
|
||||
return FAIL;
|
||||
else if (vim9 && **arg == ':')
|
||||
{
|
||||
semsg(_(e_white_space_required_before_and_after_str), ":");
|
||||
clear_tv(&var1);
|
||||
return FAIL;
|
||||
}
|
||||
else if (evaluate && tv_get_string_chk(&var1) == NULL)
|
||||
{
|
||||
// not a number or string
|
||||
@@ -3769,7 +3776,15 @@ eval_index(
|
||||
if (**arg == ':')
|
||||
{
|
||||
range = TRUE;
|
||||
*arg = skipwhite_and_linebreak(*arg + 1, evalarg);
|
||||
++*arg;
|
||||
if (!IS_WHITE_OR_NUL(**arg) && **arg != ']')
|
||||
{
|
||||
semsg(_(e_white_space_required_before_and_after_str), ":");
|
||||
if (!empty1)
|
||||
clear_tv(&var1);
|
||||
return FAIL;
|
||||
}
|
||||
*arg = skipwhite_and_linebreak(*arg, evalarg);
|
||||
if (**arg == ']')
|
||||
empty2 = TRUE;
|
||||
else if (eval1(arg, &var2, evalarg) == FAIL) // recursive!
|
||||
|
Reference in New Issue
Block a user