0
0
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:
Bram Moolenaar 2019-11-06 15:02:50 +01:00
parent 177c9f2f06
commit 1e673b9eb6
3 changed files with 30 additions and 14 deletions

View File

@ -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

View File

@ -2482,7 +2482,12 @@ 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));
if (*arg == '[')
arg = vim_strchr(arg, ']');
if (arg != NULL)
{
arg = skipwhite(skiptowhite(arg)); arg = skipwhite(skiptowhite(arg));
if ( arg[0] == '=' && arg[1] == '<' && arg[2] =='<' if ( arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
&& ((p[0] == 'l' && ((p[0] == 'l'
@ -2503,6 +2508,7 @@ ex_function(exarg_T *eap)
is_heredoc = TRUE; is_heredoc = TRUE;
} }
} }
}
/* Add the line to the function. */ /* Add the line to the function. */
if (ga_grow(&newlines, 1 + sourcing_lnum_off) == FAIL) if (ga_grow(&newlines, 1 + sourcing_lnum_off) == FAIL)

View File

@ -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,
/**/ /**/