diff src/vim9compile.c @ 23052:9775df18916b v8.2.2072

patch 8.2.2072: Vim9: list assign not well tested Commit: https://github.com/vim/vim/commit/004d9b00ba600a167746ad7af88e0baa77c95d8f Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 30 21:40:03 2020 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Mon, 30 Nov 2020 21:45:04 +0100
parents b98003d73150
children df0548b649c1
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5123,7 +5123,7 @@ compile_assignment(char_u *arg, exarg_T 
 	// 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 
     }
     else if (var_count > 0)
     {
+	char_u *wp;
+
 	// for "[var, var] = expr" evaluate the expression here, loop over the
 	// list of variables below.
-
-	p = skipwhite(op + oplen);
+	// A line break may follow the "=".
+
+	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;