Patch 8.2.2692
Problem:    Vim9: locked script variable can be changed.
Solution:   Check for locked value. (closes #8031)
Files:      src/vim9execute.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2691/src/vim9execute.c   2021-04-01 19:42:43.885534865 +0200
--- src/vim9execute.c   2021-04-02 14:34:51.012312474 +0200
***************
*** 1958,1963 ****
--- 1958,1970 ----
                    if (sv == NULL)
                        goto failed;
                    --ectx.ec_stack.ga_len;
+ 
+                   // "const" and "final" are checked at compile time, locking
+                   // the value needs to be checked here.
+                   SOURCING_LNUM = iptr->isn_lnum;
+                   if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE))
+                       goto on_error;
+ 
                    clear_tv(sv->sv_tv);
                    *sv->sv_tv = *STACK_TV_BOT(0);
                }
*** ../vim-8.2.2691/src/testdir/test_vim9_assign.vim    2021-04-01 
19:42:43.885534865 +0200
--- src/testdir/test_vim9_assign.vim    2021-04-02 14:31:58.048771064 +0200
***************
*** 1348,1353 ****
--- 1348,1364 ----
  
    lines =<< trim END
      vim9script
+     var name = 'one'
+     lockvar name
+     def SetLocked()
+       name = 'two'
+     enddef
+     SetLocked()
+   END
+   CheckScriptFailure(lines, 'E741: Value is locked: name')
+ 
+   lines =<< trim END
+     vim9script
      def SetGlobalConst()
        const g:globConst = 123
      enddef
*** ../vim-8.2.2691/src/version.c       2021-04-02 13:30:56.350856326 +0200
--- src/version.c       2021-04-02 14:32:50.432632114 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2692,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
39. You move into a new house and setup the Wifi router before
    unpacking any kitchen stuff.

 /// 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/202104021236.132CaZke2227369%40masaka.moolenaar.net.

Raspunde prin e-mail lui