forked from aniani/vim
patch 8.2.2018: Vim9: script variable not found from lambda
Problem: Vim9: script variable not found from lambda.
Solution: In a lambda also check the script hashtab for a variable without a
scope. (closes #7329)
This commit is contained in:
@@ -1476,6 +1476,15 @@ def Test_line_continuation_in_def()
|
||||
Line_continuation_in_def('.')->assert_equal('full')
|
||||
enddef
|
||||
|
||||
def Test_script_var_in_lambda()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
var script = 'test'
|
||||
assert_equal(['test'], map(['one'], {-> script}))
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Line_continuation_in_lambda(): list<string>
|
||||
var x = range(97, 100)
|
||||
->map({_, v -> nr2char(v)
|
||||
|
||||
Reference in New Issue
Block a user