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,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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user