0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.2072: Vim9: list assign not well tested

Problem:    Vim9: list assign not well tested.
Solution:   Test with different destinations.  Fix white space error.
This commit is contained in:
Bram Moolenaar
2020-11-30 21:40:03 +01:00
parent da7c20c953
commit 004d9b00ba
3 changed files with 28 additions and 2 deletions

View File

@@ -5123,7 +5123,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
// can be something like "[1, 2]->func()"
return arg;
if (oplen > 0 && (!VIM_ISWHITE(*sp) || !VIM_ISWHITE(op[oplen])))
if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
{
error_white_both(op, oplen);
return NULL;
@@ -5159,10 +5159,16 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
}
else if (var_count > 0)
{
char_u *wp;
// for "[var, var] = expr" evaluate the expression here, loop over the
// list of variables below.
// A line break may follow the "=".
p = skipwhite(op + oplen);
wp = op + oplen;
p = skipwhite(wp);
if (may_get_next_line(wp, &p, cctx) == FAIL)
return FAIL;
if (compile_expr0(&p, cctx) == FAIL)
return NULL;
end = p;