1
0
forked from aniani/vim

patch 8.2.2317: Vim9: command modifier before list unpack doesn't work

Problem:    Vim9: command modifier before list unpack doesn't work.
Solution:   Only recognize "[" directly after the name. (closes #7641)
This commit is contained in:
Bram Moolenaar
2021-01-09 12:09:22 +01:00
parent b657198cb3
commit 9e0f883f89
3 changed files with 29 additions and 18 deletions

View File

@@ -2745,15 +2745,18 @@ parse_command_modifiers(
// silent! verbose = func()
// verbose.member = 2
// verbose[expr] = 2
// But not:
// verbose [a, b] = list
if (in_vim9script())
{
char_u *s;
char_u *s, *n;
for (s = p; ASCII_ISALPHA(*s); ++s)
;
s = skipwhite(s);
if (vim_strchr((char_u *)".[=", *s) != NULL
|| (*s != NUL && s[1] == '='))
n = skipwhite(s);
if (vim_strchr((char_u *)".=", *n) != NULL
|| *s == '['
|| (*n != NUL && n[1] == '='))
break;
}

View File

@@ -1481,6 +1481,12 @@ def Test_assign_command_modifier()
assert_equal({one: 3}, topleft)
leftabove topleft[' '] = 4
assert_equal({one: 3, ' ': 4}, topleft)
var x: number
var y: number
silent [x, y] = [1, 2]
assert_equal(1, x)
assert_equal(2, y)
END
CheckDefAndScriptSuccess(lines)
enddef

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2317,
/**/
2316,
/**/