Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -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