forked from aniani/vim
patch 8.2.1817: Vim9: wrong instruction when reusing a local variable spot
Problem: Vim9: wrong instruction when reusing a local variable spot. Solution: Clear a newly allocated local variable. (closes #7080)
This commit is contained in:
@@ -2032,5 +2032,23 @@ def Test_callstack_def()
|
||||
endtry
|
||||
enddef
|
||||
|
||||
" Re-using spot for variable used in block
|
||||
def Test_block_scoped_var()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Func()
|
||||
var x = ['a', 'b', 'c']
|
||||
if 1
|
||||
var y = 'x'
|
||||
map(x, {-> y})
|
||||
endif
|
||||
var z = x
|
||||
assert_equal(['x', 'x', 'x'], z)
|
||||
enddef
|
||||
Func()
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
|
||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||
|
||||
Reference in New Issue
Block a user