mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
c3cb54b5ff
commit
3e2f7baf21
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user