0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.4331: Vim9: no test for existing script variable in block

Problem:    Vim9: no test for existing script variable in block.
Solution:   Add a test.
This commit is contained in:
Bram Moolenaar
2022-02-08 19:23:35 +00:00
parent 779aeff5c3
commit 3a5988c025
2 changed files with 27 additions and 1 deletions

View File

@@ -1028,11 +1028,35 @@ def Test_call_wrong_args()
vim9script
var name = 'piet'
def FuncOne(name: string)
echo nr
echo name
enddef
END
v9.CheckScriptFailure(lines, 'E1168:')
# same, inside the same block
lines =<< trim END
vim9script
if true
var name = 'piet'
def FuncOne(name: string)
echo name
enddef
endif
END
v9.CheckScriptFailure(lines, 'E1168:')
# variable in other block is OK
lines =<< trim END
vim9script
if true
var name = 'piet'
endif
def FuncOne(name: string)
echo name
enddef
END
v9.CheckScriptSuccess(lines)
# argument name declared later is only found when compiling
lines =<< trim END
vim9script

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4331,
/**/
4330,
/**/