# HG changeset patch # User Bram Moolenaar # Date 1574784903 -3600 # Node ID bd4c34db84ab3fafb67c64b657e6305b27cd1d05 # Parent 85d425beb6c17220e63880b1a1b6dfb45865af2a patch 8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif" Commit: https://github.com/vim/vim/commit/cc4423ae13d78367a3d0b5756783523d3b3a1d31 Author: Bram Moolenaar Date: Tue Nov 26 17:05:00 2019 +0100 patch 8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif" Problem: :lockvar and :unlockvar cannot be followed by "| endif". Solution: Check for following commands. (closes https://github.com/vim/vim/issues/5269) diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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: diff --git a/src/testdir/test_const.vim b/src/testdir/test_const.vim --- a/src/testdir/test_const.vim +++ b/src/testdir/test_const.vim @@ -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:') diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -738,6 +738,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2349, +/**/ 2348, /**/ 2347,