summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-30 21:40:03 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-30 21:40:03 +0100
commit004d9b00ba600a167746ad7af88e0baa77c95d8f (patch)
treea23080d1e2d715ad87dc1ec4c25e7733aeaa0269 /src/vim9compile.c
parentda7c20c9531739bdefa9d4418e6765fb181066e9 (diff)
downloadvim-git-004d9b00ba600a167746ad7af88e0baa77c95d8f.tar.gz
patch 8.2.2072: Vim9: list assign not well testedv8.2.2072
Problem: Vim9: list assign not well tested. Solution: Test with different destinations. Fix white space error.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 0620be00c..1e65239c2 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -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;