assert_equal(3, &ts)
assert_equal(4, &sw)
set ts=8 sw=4
+
+ [@a, @z] = ['aa', 'zz']
+ assert_equal('aa', @a)
+ assert_equal('zz', @z)
+
+ [$SOME_VAR, $OTHER_VAR] = ['some', 'other']
+ assert_equal('some', $SOME_VAR)
+ assert_equal('other', $OTHER_VAR)
+
+ [g:globalvar, s:scriptvar, b:bufvar, w:winvar, t:tabvar, v:errmsg] =
+ ['global', 'script', 'buf', 'win', 'tab', 'error']
+ assert_equal('global', g:globalvar)
+ assert_equal('script', s:scriptvar)
+ assert_equal('buf', b:bufvar)
+ assert_equal('win', w:winvar)
+ assert_equal('tab', t:tabvar)
+ assert_equal('error', v:errmsg)
+ unlet g:globalvar
END
CheckDefAndScriptSuccess(lines)
enddef
// 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;
}
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;