mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.2262: unpack assignment in function not recognized
Problem: Unpack assignment in function not recognized. Solution: Skip over "[a, b]". (closes #5051)
This commit is contained in:
parent
177c9f2f06
commit
1e673b9eb6
@ -303,4 +303,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
|
||||||
|
@ -2482,25 +2482,31 @@ 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'
|
if (arg != NULL)
|
||||||
&& p[1] == 'e'
|
|
||||||
&& (!ASCII_ISALNUM(p[2])
|
|
||||||
|| (p[2] == 't' && !ASCII_ISALNUM(p[3]))))))
|
|
||||||
{
|
{
|
||||||
p = skipwhite(arg + 3);
|
arg = skipwhite(skiptowhite(arg));
|
||||||
if (STRNCMP(p, "trim", 4) == 0)
|
if ( arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
|
||||||
|
&& ((p[0] == 'l'
|
||||||
|
&& p[1] == 'e'
|
||||||
|
&& (!ASCII_ISALNUM(p[2])
|
||||||
|
|| (p[2] == 't' && !ASCII_ISALNUM(p[3]))))))
|
||||||
{
|
{
|
||||||
// Ignore leading white space.
|
p = skipwhite(arg + 3);
|
||||||
p = skipwhite(p + 4);
|
if (STRNCMP(p, "trim", 4) == 0)
|
||||||
heredoc_trimmed = vim_strnsave(theline,
|
{
|
||||||
|
// Ignore leading white space.
|
||||||
|
p = skipwhite(p + 4);
|
||||||
|
heredoc_trimmed = vim_strnsave(theline,
|
||||||
(int)(skipwhite(theline) - 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2262,
|
||||||
/**/
|
/**/
|
||||||
2261,
|
2261,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user