comparison src/testdir/test_vim9_func.vim @ 20244:23d75968ca5e

patch 8.2.0677: Vim9: no support for closures Commit: https://github.com/vim/vim/commit/c8cd2b34d1027c93fbca90f3cdc8123fe22dfa25 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 1 19:29:08 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 01 May 2020 19:30:04 +0200
parents 63cc54100ae4
children e46e72aaff74
comparison
equal deleted inserted replaced
20243:6e7fd8949651 20244:23d75968ca5e
639 let caught_1059 = 1 639 let caught_1059 = 1
640 endtry 640 endtry
641 call assert_equal(1, caught_1059) 641 call assert_equal(1, caught_1059)
642 endfunc 642 endfunc
643 643
644 def RefFunc(Ref: func(string): string): string
645 return Ref('more')
646 enddef
647
648 def Test_closure_simple()
649 let local = 'some '
650 assert_equal('some more', RefFunc({s -> local .. s}))
651 enddef
652
644 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 653 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker