forked from aniani/vim
patch 8.2.4227: Vim9: using "lockvar!" in :def function does not work
Problem: Vim9: using "lockvar!" in :def function does not work. Solution: Add "!" instead of "-1". (closes #9634)
This commit is contained in:
parent
fc4c44836a
commit
e939f5ebba
@ -1425,6 +1425,17 @@ def Test_lockvar()
|
||||
assert_equal([0, 1, 2], g:therange)
|
||||
unlet g:therange
|
||||
|
||||
# use exclamation mark for locking deeper
|
||||
g:nestedlist = [1, [2, 3], 4]
|
||||
lockvar! g:nestedlist
|
||||
try
|
||||
g:nestedlist[1][0] = 9
|
||||
catch /E1119:/
|
||||
caught = true
|
||||
endtry
|
||||
assert_true(caught)
|
||||
unlet g:nestedlist
|
||||
|
||||
var d = {a: 1, b: 2}
|
||||
d.a = 3
|
||||
d.b = 4
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4227,
|
||||
/**/
|
||||
4226,
|
||||
/**/
|
||||
|
@ -223,10 +223,12 @@ compile_lock_unlock(
|
||||
ret = FAIL;
|
||||
else
|
||||
{
|
||||
vim_snprintf((char *)buf, len, "%s %d %s",
|
||||
eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar",
|
||||
deep,
|
||||
p);
|
||||
char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
|
||||
|
||||
if (deep < 0)
|
||||
vim_snprintf((char *)buf, len, "%s! %s", cmd, p);
|
||||
else
|
||||
vim_snprintf((char *)buf, len, "%s %d %s", cmd, deep, p);
|
||||
ret = generate_EXEC_copy(cctx, isn, buf);
|
||||
|
||||
vim_free(buf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user