]> granicus.if.org Git - vim/commitdiff
patch 8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif" v8.1.2349
authorBram Moolenaar <Bram@vim.org>
Tue, 26 Nov 2019 16:05:00 +0000 (17:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 26 Nov 2019 16:05:00 +0000 (17:05 +0100)
Problem:    :lockvar and :unlockvar cannot be followed by "| endif".
Solution:   Check for following commands. (closes #5269)

src/ex_docmd.c
src/testdir/test_const.vim
src/version.c

index 576a75674a4830d809b979034a65f73b9d9d2d03..ed7512f7698d86c6374a6bc41f111a23c364390d 100644 (file)
@@ -2384,6 +2384,7 @@ do_one_cmd(
            case CMD_leftabove:
            case CMD_let:
            case CMD_lockmarks:
+           case CMD_lockvar:
            case CMD_lua:
            case CMD_match:
            case CMD_mzscheme:
@@ -2408,6 +2409,7 @@ do_one_cmd(
            case CMD_tilde:
            case CMD_topleft:
            case CMD_unlet:
+           case CMD_unlockvar:
            case CMD_verbose:
            case CMD_vertical:
            case CMD_wincmd:
index 8df34f4ad65316a8e652bbfd5072173152d087f2..7f950910b3a4ce6536f4bd56f4d090b19a4e3624 100644 (file)
@@ -203,6 +203,20 @@ func Test_const_with_condition()
   call assert_equal(0, x)
 endfunc
 
+func Test_lockvar()
+  let x = 'hello'
+  lockvar x
+  call assert_fails('let x = "there"', 'E741')
+  if 0 | unlockvar x | endif
+  call assert_fails('let x = "there"', 'E741')
+  unlockvar x
+  let x = 'there'
+
+  if 0 | lockvar x | endif
+  let x = 'again'
+endfunc
+
+
 func Test_const_with_index_access()
     let l = [1, 2, 3]
     call assert_fails('const l[0] = 4', 'E996:')
index 70df145126bab20aa017f94e83013e019f8e61ba..36e43a849c65de7e91450b81875035ead40de482 100644 (file)
@@ -737,6 +737,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2349,
 /**/
     2348,
 /**/