Mercurial > vim
comparison src/vim9cmds.c @ 27394:69a48bcd1d80 v8.2.4225
patch 8.2.4225: Vim9: depth argument of :lockvar not parsed in :def function
Commit: https://github.com/vim/vim/commit/70c43d84be98ab54d3723155dcc4232dc5a5f081
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 26 21:01:15 2022 +0000
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 https://github.com/vim/vim/issues/9629)
Fix that locking doesn't work for a non-materialize list.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 Jan 2022 22:15:03 +0100 |
parents | 7218ad7a55d2 |
children | 472bb63632bd |
comparison
equal
deleted
inserted
replaced
27393:db7fa549029b | 27394:69a48bcd1d80 |
---|---|
176 static int | 176 static int |
177 compile_lock_unlock( | 177 compile_lock_unlock( |
178 lval_T *lvp, | 178 lval_T *lvp, |
179 char_u *name_end, | 179 char_u *name_end, |
180 exarg_T *eap, | 180 exarg_T *eap, |
181 int deep UNUSED, | 181 int deep, |
182 void *coookie) | 182 void *coookie) |
183 { | 183 { |
184 cctx_T *cctx = coookie; | 184 cctx_T *cctx = coookie; |
185 int cc = *name_end; | 185 int cc = *name_end; |
186 char_u *p = lvp->ll_name; | 186 char_u *p = lvp->ll_name; |
221 buf = alloc(len); | 221 buf = alloc(len); |
222 if (buf == NULL) | 222 if (buf == NULL) |
223 ret = FAIL; | 223 ret = FAIL; |
224 else | 224 else |
225 { | 225 { |
226 vim_snprintf((char *)buf, len, "%s %s", | 226 vim_snprintf((char *)buf, len, "%s %d %s", |
227 eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar", | 227 eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar", |
228 deep, | |
228 p); | 229 p); |
229 ret = generate_EXEC_copy(cctx, isn, buf); | 230 ret = generate_EXEC_copy(cctx, isn, buf); |
230 | 231 |
231 vim_free(buf); | 232 vim_free(buf); |
232 *name_end = cc; | 233 *name_end = cc; |
239 * "arg" points to "var". | 240 * "arg" points to "var". |
240 */ | 241 */ |
241 char_u * | 242 char_u * |
242 compile_unletlock(char_u *arg, exarg_T *eap, cctx_T *cctx) | 243 compile_unletlock(char_u *arg, exarg_T *eap, cctx_T *cctx) |
243 { | 244 { |
244 ex_unletlock(eap, arg, 0, GLV_NO_AUTOLOAD | GLV_COMPILING, | 245 int deep = 0; |
246 char_u *p = arg; | |
247 | |
248 if (eap->cmdidx != CMD_unlet) | |
249 { | |
250 if (eap->forceit) | |
251 deep = -1; | |
252 else if (vim_isdigit(*p)) | |
253 { | |
254 deep = getdigits(&p); | |
255 p = skipwhite(p); | |
256 } | |
257 else | |
258 deep = 2; | |
259 } | |
260 | |
261 ex_unletlock(eap, p, deep, GLV_NO_AUTOLOAD | GLV_COMPILING, | |
245 eap->cmdidx == CMD_unlet ? compile_unlet : compile_lock_unlock, | 262 eap->cmdidx == CMD_unlet ? compile_unlet : compile_lock_unlock, |
246 cctx); | 263 cctx); |
247 return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd; | 264 return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd; |
248 } | 265 } |
249 | 266 |