]> granicus.if.org Git - vim/commitdiff
patch 9.0.0499: in :def function list created after const is locked v9.0.0499
authorBram Moolenaar <Bram@vim.org>
Sun, 18 Sep 2022 12:46:08 +0000 (13:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 18 Sep 2022 12:46:08 +0000 (13:46 +0100)
Problem:    In :def function list created after const is locked.
Solution:   Reset v_lock. (closes #11154)

src/testdir/test_vim9_assign.vim
src/version.c
src/vim9execute.c

index 730212d109dbd5e83c9911ca149dfb379879f60f..3957942db1ad9002ed209a97041d8dc1e1cf60f2 100644 (file)
@@ -2023,6 +2023,13 @@ def Test_var_declaration()
   unlet w:FLIST
 enddef
 
+def Test_create_list_after_const()
+  const a = 1
+  g:ll = []
+  assert_equal(0, islocked('g:ll'))
+  unlet g:ll
+enddef
+
 def Test_var_declaration_fails()
   var lines =<< trim END
     vim9script
index 16ba3ee25790703dc78277098126d2c273b197bd..415897ae3b7e6e6094e13acd3a242090f3d3a5f7 100644 (file)
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    499,
 /**/
     498,
 /**/
index 22dfaaa52deab00e81f48a1a87d60732ba038fb2..c2a3310813094512185dbaa2a61816864058bb5a 100644 (file)
@@ -200,6 +200,7 @@ exe_newlist(int count, ectx_T *ectx)
     tv = STACK_TV_BOT(-1);
     tv->v_type = VAR_LIST;
     tv->vval.v_list = list;
+    tv->v_lock = 0;
     if (list != NULL)
        ++list->lv_refcount;
     return OK;