0
0
mirror of https://github.com/vim/vim.git synced 2025-11-09 10:37:17 -05:00

patch 8.2.0677: Vim9: no support for closures

Problem:    Vim9: no support for closures.
Solution:   Find variables in the outer function scope, so long as the scope
            exists.
This commit is contained in:
Bram Moolenaar
2020-05-01 19:29:08 +02:00
parent 37addecc42
commit c8cd2b34d1
8 changed files with 223 additions and 126 deletions

View File

@@ -641,4 +641,13 @@ func Test_E1056_1059()
call assert_equal(1, caught_1059)
endfunc
def RefFunc(Ref: func(string): string): string
return Ref('more')
enddef
def Test_closure_simple()
let local = 'some '
assert_equal('some more', RefFunc({s -> local .. s}))
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker