Patch 8.2.2317
Problem:    Vim9: command modifier before list unpack doesn't work.
Solution:   Only recognize "[" directly after the name. (closes #7641)
Files:      src/ex_docmd.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2316/src/ex_docmd.c      2021-01-07 22:02:58.688148992 +0100
--- src/ex_docmd.c      2021-01-09 12:03:42.024481135 +0100
***************
*** 2745,2759 ****
        //   silent! verbose = func()
        //   verbose.member = 2
        //   verbose[expr] = 2
        if (in_vim9script())
        {
!           char_u *s;
  
            for (s = p; ASCII_ISALPHA(*s); ++s)
                ;
!           s = skipwhite(s);
!           if (vim_strchr((char_u *)".[=", *s) != NULL
!                                                || (*s != NUL && s[1] == '='))
                break;
        }
  
--- 2745,2762 ----
        //   silent! verbose = func()
        //   verbose.member = 2
        //   verbose[expr] = 2
+       // But not:
+       //   verbose [a, b] = list
        if (in_vim9script())
        {
!           char_u *s, *n;
  
            for (s = p; ASCII_ISALPHA(*s); ++s)
                ;
!           n = skipwhite(s);
!           if (vim_strchr((char_u *)".=", *n) != NULL
!                   || *s == '['
!                   || (*n != NUL && n[1] == '='))
                break;
        }
  
*** ../vim-8.2.2316/src/testdir/test_vim9_assign.vim    2021-01-07 
22:02:58.688148992 +0100
--- src/testdir/test_vim9_assign.vim    2021-01-09 12:08:49.063929013 +0100
***************
*** 1466,1486 ****
  
  def Test_assign_command_modifier()
    var lines =<< trim END
!     var verbose = 0
!     verbose = 1
!     assert_equal(1, verbose)
!     silent verbose = 2
!     assert_equal(2, verbose)
!     silent verbose += 2
!     assert_equal(4, verbose)
!     silent verbose -= 1
!     assert_equal(3, verbose)
  
!     var topleft = {one: 1}
!     sandbox topleft.one = 3
!     assert_equal({one: 3}, topleft)
!     leftabove topleft[' '] = 4
!     assert_equal({one: 3, ' ': 4}, topleft)
    END
    CheckDefAndScriptSuccess(lines)
  enddef
--- 1466,1492 ----
  
  def Test_assign_command_modifier()
    var lines =<< trim END
!       var verbose = 0
!       verbose = 1
!       assert_equal(1, verbose)
!       silent verbose = 2
!       assert_equal(2, verbose)
!       silent verbose += 2
!       assert_equal(4, verbose)
!       silent verbose -= 1
!       assert_equal(3, verbose)
  
!       var topleft = {one: 1}
!       sandbox topleft.one = 3
!       assert_equal({one: 3}, topleft)
!       leftabove topleft[' '] = 4
!       assert_equal({one: 3, ' ': 4}, topleft)
! 
!       var x: number
!       var y: number
!       silent [x, y] = [1, 2]
!       assert_equal(1, x)
!       assert_equal(2, y)
    END
    CheckDefAndScriptSuccess(lines)
  enddef
*** ../vim-8.2.2316/src/version.c       2021-01-08 22:24:16.467725889 +0100
--- src/version.c       2021-01-09 12:05:01.000328093 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2317,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
115. You are late picking up your kid from school and try to explain
     to the teacher you were stuck in Web traffic.

 /// 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/202101091109.109B9pp4016215%40masaka.moolenaar.net.

Raspunde prin e-mail lui