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,22 +21742,31 @@ void ex_function(exarg_T *eap)
} }
// Check for ":let v =<< [trim] EOF" // Check for ":let v =<< [trim] EOF"
// and ":let [a, b] =<< [trim] EOF"
arg = skipwhite(skiptowhite(p)); arg = skipwhite(skiptowhite(p));
arg = skipwhite(skiptowhite(arg)); if (*arg == '[') {
if (arg[0] == '=' && arg[1] == '<' && arg[2] =='<' arg = vim_strchr(arg, ']');
&& ((p[0] == 'l' && p[1] == 'e' }
&& (!ASCII_ISALNUM(p[2]) if (arg != NULL) {
|| (p[2] == 't' && !ASCII_ISALNUM(p[3])))))) { arg = skipwhite(skiptowhite(arg));
p = skipwhite(arg + 3); if (arg[0] == '='
if (STRNCMP(p, "trim", 4) == 0) { && arg[1] == '<'
// Ignore leading white space. && arg[2] =='<'
p = skipwhite(p + 4); && (p[0] == 'l'
heredoc_trimmed = vim_strnsave(theline, && p[1] == 'e'
(int)(skipwhite(theline) - theline)); && (!ASCII_ISALNUM(p[2])
|| (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));
}
skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
do_concat = false;
is_heredoc = true;
} }
skip_until = vim_strnsave(p, (int)(skiptowhite(p) - p));
do_concat = false;
is_heredoc = true;
} }
} }

View File

@ -289,4 +289,12 @@ E
END END
endif endif
call assert_equal([], check) 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 endfunc