mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.3651: Vim9: no error for :lock or :unlock with unknown variable
Problem: Vim9: no error for :lock or :unlock with unknown variable. Solution: Give an error. (closes #9188)
This commit is contained in:
@@ -686,3 +686,5 @@ EXTERN char e_bad_color_string_str[]
|
|||||||
INIT(= N_("E1244: Bad color string: %s"));
|
INIT(= N_("E1244: Bad color string: %s"));
|
||||||
EXTERN char e_cannot_expand_sfile_in_vim9_function[]
|
EXTERN char e_cannot_expand_sfile_in_vim9_function[]
|
||||||
INIT(= N_("E1245: Cannot expand <sfile> in a Vim9 function"));
|
INIT(= N_("E1245: Cannot expand <sfile> in a Vim9 function"));
|
||||||
|
EXTERN char e_cannot_find_variable_to_unlock_str[]
|
||||||
|
INIT(= N_("E1246: Cannot find variable to (un)lock: %s"));
|
||||||
|
@@ -1827,7 +1827,12 @@ do_lock_var(
|
|||||||
// Normal name or expanded name.
|
// Normal name or expanded name.
|
||||||
di = find_var(lp->ll_name, NULL, TRUE);
|
di = find_var(lp->ll_name, NULL, TRUE);
|
||||||
if (di == NULL)
|
if (di == NULL)
|
||||||
|
{
|
||||||
|
if (in_vim9script())
|
||||||
|
semsg(_(e_cannot_find_variable_to_unlock_str),
|
||||||
|
lp->ll_name);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
}
|
||||||
else if ((di->di_flags & DI_FLAGS_FIX)
|
else if ((di->di_flags & DI_FLAGS_FIX)
|
||||||
&& di->di_tv.v_type != VAR_DICT
|
&& di->di_tv.v_type != VAR_DICT
|
||||||
&& di->di_tv.v_type != VAR_LIST)
|
&& di->di_tv.v_type != VAR_LIST)
|
||||||
|
@@ -1370,6 +1370,23 @@ def Test_lockvar()
|
|||||||
unlockvar theList
|
unlockvar theList
|
||||||
END
|
END
|
||||||
CheckDefFailure(lines, 'E1178', 2)
|
CheckDefFailure(lines, 'E1178', 2)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
var name = 'john'
|
||||||
|
lockvar nameX
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1246', 3)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
var name = 'john'
|
||||||
|
def LockIt()
|
||||||
|
lockvar nameX
|
||||||
|
enddef
|
||||||
|
LockIt()
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1246', 1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_substitute_expr()
|
def Test_substitute_expr()
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3651,
|
||||||
/**/
|
/**/
|
||||||
3650,
|
3650,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user