Patch 8.2.4227
Problem:    Vim9: using "lockvar!" in :def function does not work.
Solution:   Add "!" instead of "-1". (closes #9634)
Files:      src/vim9cmds.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4226/src/vim9cmds.c      2022-01-26 21:01:11.188928567 +0000
--- src/vim9cmds.c      2022-01-26 21:28:59.239708104 +0000
***************
*** 223,232 ****
        ret = FAIL;
      else
      {
!       vim_snprintf((char *)buf, len, "%s %d %s",
!               eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar",
!               deep,
!               p);
        ret = generate_EXEC_copy(cctx, isn, buf);
  
        vim_free(buf);
--- 223,234 ----
        ret = FAIL;
      else
      {
!       char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
! 
!       if (deep < 0)
!           vim_snprintf((char *)buf, len, "%s! %s", cmd, p);
!       else
!           vim_snprintf((char *)buf, len, "%s %d %s", cmd, deep, p);
        ret = generate_EXEC_copy(cctx, isn, buf);
  
        vim_free(buf);
*** ../vim-8.2.4226/src/testdir/test_vim9_cmd.vim       2022-01-26 
21:01:11.192928481 +0000
--- src/testdir/test_vim9_cmd.vim       2022-01-26 21:32:00.520516489 +0000
***************
*** 1425,1430 ****
--- 1425,1441 ----
    assert_equal([0, 1, 2], g:therange)
    unlet g:therange
  
+   # use exclamation mark for locking deeper
+   g:nestedlist = [1, [2, 3], 4]
+   lockvar! g:nestedlist
+   try
+     g:nestedlist[1][0] = 9
+   catch /E1119:/
+     caught = true
+   endtry
+   assert_true(caught)
+   unlet g:nestedlist
+ 
    var d = {a: 1, b: 2}
    d.a = 3
    d.b = 4
*** ../vim-8.2.4226/src/version.c       2022-01-26 21:17:00.552771590 +0000
--- src/version.c       2022-01-26 21:27:21.417366055 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4227,
  /**/

-- 
Every time I lose weight, it finds me again!

 /// 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/20220126213338.A9E371C0918%40moolenaar.net.

Raspunde prin e-mail lui