comparison src/testdir/test_vim9_func.vim @ 22942:4759d13193fb v8.2.2018

patch 8.2.2018: Vim9: script variable not found from lambda Commit: https://github.com/vim/vim/commit/2ea95b61f4bec9b71cf916eebe8d11abc76617a0 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 19 21:47:56 2020 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 19 Nov 2020 22:00:05 +0100
parents 00b0275ffe7f
children 707b90980de5
comparison
equal deleted inserted replaced
22941:2aa5ad6cb21c 22942:4759d13193fb
1474 1474
1475 def Test_line_continuation_in_def() 1475 def Test_line_continuation_in_def()
1476 Line_continuation_in_def('.')->assert_equal('full') 1476 Line_continuation_in_def('.')->assert_equal('full')
1477 enddef 1477 enddef
1478 1478
1479 def Test_script_var_in_lambda()
1480 var lines =<< trim END
1481 vim9script
1482 var script = 'test'
1483 assert_equal(['test'], map(['one'], {-> script}))
1484 END
1485 CheckScriptSuccess(lines)
1486 enddef
1487
1479 def Line_continuation_in_lambda(): list<string> 1488 def Line_continuation_in_lambda(): list<string>
1480 var x = range(97, 100) 1489 var x = range(97, 100)
1481 ->map({_, v -> nr2char(v) 1490 ->map({_, v -> nr2char(v)
1482 ->toupper()}) 1491 ->toupper()})
1483 ->reverse() 1492 ->reverse()