Patch 8.2.2072
Problem:    Vim9: list assign not well tested.
Solution:   Test with different destinations.  Fix white space error.
Files:      src/vim9compile.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2071/src/vim9compile.c   2020-11-28 18:52:29.999995143 +0100
--- src/vim9compile.c   2020-11-30 21:30:23.274537282 +0100
***************
*** 5123,5129 ****
        // can be something like "[1, 2]->func()"
        return arg;
  
!     if (oplen > 0 && (!VIM_ISWHITE(*sp) || !VIM_ISWHITE(op[oplen])))
      {
        error_white_both(op, oplen);
        return NULL;
--- 5123,5129 ----
        // can be something like "[1, 2]->func()"
        return arg;
  
!     if (oplen > 0 && (!VIM_ISWHITE(*sp) || !IS_WHITE_OR_NUL(op[oplen])))
      {
        error_white_both(op, oplen);
        return NULL;
***************
*** 5159,5168 ****
      }
      else if (var_count > 0)
      {
        // for "[var, var] = expr" evaluate the expression here, loop over the
        // list of variables below.
  
!       p = skipwhite(op + oplen);
        if (compile_expr0(&p, cctx) == FAIL)
            return NULL;
        end = p;
--- 5159,5174 ----
      }
      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 "=".
  
!       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;
*** ../vim-8.2.2071/src/testdir/test_vim9_assign.vim    2020-11-30 
21:12:15.747157517 +0100
--- src/testdir/test_vim9_assign.vim    2020-11-30 21:33:57.381698945 +0100
***************
*** 657,662 ****
--- 657,680 ----
        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
*** ../vim-8.2.2071/src/version.c       2020-11-30 21:12:15.747157517 +0100
--- src/version.c       2020-11-30 21:39:44.384365947 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2072,
  /**/

-- 
BLACK KNIGHT:  I move for no man.
ARTHUR:        So be it!
    [hah] [parry thrust]
    [ARTHUR chops the BLACK KNIGHT's left arm off]
ARTHUR:        Now stand aside, worthy adversary.
BLACK KNIGHT:  'Tis but a scratch.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202011302040.0AUKeSuJ3632201%40masaka.moolenaar.net.

Raspunde prin e-mail lui