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

patch 8.2.4643: Vim9: variable may be locked unintentionally

Problem:    Vim9: variable may be locked unintentionally.
Solution:   Clear "v_lock". (closes #10036)
This commit is contained in:
Bram Moolenaar
2022-03-28 18:16:52 +01:00
parent 859cc21c6b
commit 24565cf27b
3 changed files with 10 additions and 0 deletions

View File

@@ -371,10 +371,17 @@ def Test_bufname()
assert_fails('bufname([])', 'E1220:') assert_fails('bufname([])', 'E1220:')
enddef enddef
let s:bufnr_res = 0
def Test_bufnr() def Test_bufnr()
var buf = bufnr() var buf = bufnr()
bufnr('%')->assert_equal(buf) bufnr('%')->assert_equal(buf)
# check the lock is not taken over through the stack
const nr = 10
bufnr_res = bufnr()
bufnr_res = 12345
buf = bufnr('Xdummy', true) buf = bufnr('Xdummy', true)
buf->assert_notequal(-1) buf->assert_notequal(-1)
exe 'bwipe! ' .. buf exe 'bwipe! ' .. buf

View File

@@ -750,6 +750,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 */
/**/
4643,
/**/ /**/
4642, 4642,
/**/ /**/

View File

@@ -937,6 +937,7 @@ call_prepare(int argcount, typval_T *argvars, ectx_T *ectx)
tv = STACK_TV_BOT(-1); tv = STACK_TV_BOT(-1);
tv->v_type = VAR_NUMBER; tv->v_type = VAR_NUMBER;
tv->vval.v_number = 0; tv->vval.v_number = 0;
tv->v_lock = 0;
return OK; return OK;
} }