0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def function

Problem:    Vim9: depth argument of :lockvar not parsed in :def function.
Solution:   Parse the optional depth argument. (closes #9629)
            Fix that locking doesn't work for a non-materialize list.
This commit is contained in:
Bram Moolenaar
2022-01-26 21:01:15 +00:00
parent 1080c48ec8
commit 70c43d84be
9 changed files with 82 additions and 18 deletions

View File

@@ -178,7 +178,7 @@ compile_lock_unlock(
lval_T *lvp,
char_u *name_end,
exarg_T *eap,
int deep UNUSED,
int deep,
void *coookie)
{
cctx_T *cctx = coookie;
@@ -223,8 +223,9 @@ compile_lock_unlock(
ret = FAIL;
else
{
vim_snprintf((char *)buf, len, "%s %s",
vim_snprintf((char *)buf, len, "%s %d %s",
eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar",
deep,
p);
ret = generate_EXEC_copy(cctx, isn, buf);
@@ -241,7 +242,23 @@ compile_lock_unlock(
char_u *
compile_unletlock(char_u *arg, exarg_T *eap, cctx_T *cctx)
{
ex_unletlock(eap, arg, 0, GLV_NO_AUTOLOAD | GLV_COMPILING,
int deep = 0;
char_u *p = arg;
if (eap->cmdidx != CMD_unlet)
{
if (eap->forceit)
deep = -1;
else if (vim_isdigit(*p))
{
deep = getdigits(&p);
p = skipwhite(p);
}
else
deep = 2;
}
ex_unletlock(eap, p, deep, GLV_NO_AUTOLOAD | GLV_COMPILING,
eap->cmdidx == CMD_unlet ? compile_unlet : compile_lock_unlock,
cctx);
return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd;