Patch 8.2.3053
Problem:    Vim9: cannot assign to @@ in :def function
Solution:   Handle '@' like '"'.
Files:      src/vim9compile.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.3052/src/vim9compile.c   2021-06-26 13:00:45.734565919 +0200
--- src/vim9compile.c   2021-06-26 13:20:18.008217816 +0200
***************
*** 5854,5860 ****
      }
      else if (*name == '@')
      {
!       if (!valid_yank_reg(name[1], FALSE) || name[1] == '.')
        {
            emsg_invreg(name[1]);
            return FAIL;
--- 5854,5861 ----
      }
      else if (*name == '@')
      {
!       if (name[1] != '@'
!                       && (!valid_yank_reg(name[1], FALSE) || name[1] == '.'))
        {
            emsg_invreg(name[1]);
            return FAIL;
*** ../vim-8.2.3052/src/testdir/test_vim9_assign.vim    2021-06-25 
21:31:03.379070659 +0200
--- src/testdir/test_vim9_assign.vim    2021-06-26 13:23:29.287843017 +0200
***************
*** 228,243 ****
    CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')
    CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1012:')
  
-   lines =<< trim END
-     @c = 'areg'
-     @c ..= 'add'
-     assert_equal('aregadd', @c)
-   END
-   CheckDefAndScriptSuccess(lines)
- 
-   CheckDefFailure(['@a += "more"'], 'E1051:')
-   CheckDefFailure(['@a += 123'], 'E1012:')
- 
    v:errmsg = 'none'
    v:errmsg ..= 'again'
    assert_equal('noneagain', v:errmsg)
--- 228,233 ----
***************
*** 249,254 ****
--- 239,259 ----
    END
  enddef
  
+ def Test_assign_register()
+   var lines =<< trim END
+     @c = 'areg'
+     @c ..= 'add'
+     assert_equal('aregadd', @c)
+ 
+     @@ = 'some text'
+     assert_equal('some text', getreg('"'))
+   END
+   CheckDefAndScriptSuccess(lines)
+ 
+   CheckDefFailure(['@a += "more"'], 'E1051:')
+   CheckDefFailure(['@a += 123'], 'E1012:')
+ enddef
+ 
  def Test_reserved_name()
    for name in ['true', 'false', 'null']
      CheckDefExecAndScriptFailure(['var ' .. name .. ' =  0'], 'E1034:')
*** ../vim-8.2.3052/src/version.c       2021-06-26 13:00:45.734565919 +0200
--- src/version.c       2021-06-26 13:21:10.920114029 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3053,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with a 10 Mbit connection.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/202106261129.15QBTAV1306681%40masaka.moolenaar.net.

Raspunde prin e-mail lui