vim-patch:8.1.2262: unpack assignment in function not recognized

Problem:    Unpack assignment in function not recognized.
Solution:   Skip over "[a, b]". (closes vim/vim#5051)
1e673b9eb6
This commit is contained in:
Jan Edmund Lazo 2019-11-06 22:32:54 -05:00
parent c3cb54b5ff
commit 3e2f7baf21
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 31 additions and 14 deletions

View File

@ -21742,24 +21742,33 @@ void ex_function(exarg_T *eap)
}
// Check for ":let v =<< [trim] EOF"
// and ":let [a, b] =<< [trim] EOF"
arg = skipwhite(skiptowhite(p));
if (*arg == '[') {
arg = vim_strchr(arg, ']');
}
if (arg != NULL) {
arg = skipwhite(skiptowhite(arg));
if (arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
&& ((p[0] == 'l' && p[1] == 'e'
if (arg[0] == '='
&& arg[1] == '<'
&& arg[2] =='<'
&& (p[0] == 'l'
&& p[1] == 'e'
&& (!ASCII_ISALNUM(p[2])
|| (p[2] == 't' && !ASCII_ISALNUM(p[3])))))) {
|| (p[2] == 't' && !ASCII_ISALNUM(p[3]))))) {
p = skipwhite(arg + 3);
if (STRNCMP(p, "trim", 4) == 0) {
// Ignore leading white space.
p = skipwhite(p + 4);
heredoc_trimmed = vim_strnsave(theline,
(int)(skipwhite(theline) - theline));
heredoc_trimmed =
vim_strnsave(theline, (int)(skipwhite(theline) - theline));
}
skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
do_concat = false;
is_heredoc = true;
}
}
}
/* Add the line to the function. */
ga_grow(&newlines, 1 + sourcing_lnum_off);

View File

@ -289,4 +289,12 @@ E
END
endif
call assert_equal([], check)
" unpack assignment
let [a, b, c] =<< END
x
\y
z
END
call assert_equal([' x', ' \y', ' z'], [a, b, c])
endfunc