Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 20247:e46e72aaff74 v8.2.0679
patch 8.2.0679: Vim9: incomplete support for closures
Commit: https://github.com/vim/vim/commit/bf67ea1af05cbb30cd8f0b665fb567c0dca79796
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 2 17:52:42 2020 +0200
patch 8.2.0679: Vim9: incomplete support for closures
Problem: Vim9: incomplete support for closures.
Solution: At the end of a function copy arguments and local variables if
they are still used by a referenced closure.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 May 2020 18:00:04 +0200 |
parents | 23d75968ca5e |
children | 6f9010b6f7f9 |
comparison
equal
deleted
inserted
replaced
20246:ef2250432801 | 20247:e46e72aaff74 |
---|---|
648 def Test_closure_simple() | 648 def Test_closure_simple() |
649 let local = 'some ' | 649 let local = 'some ' |
650 assert_equal('some more', RefFunc({s -> local .. s})) | 650 assert_equal('some more', RefFunc({s -> local .. s})) |
651 enddef | 651 enddef |
652 | 652 |
653 def MakeRef() | |
654 let local = 'some ' | |
655 g:Ref = {s -> local .. s} | |
656 enddef | |
657 | |
658 def Test_closure_ref_after_return() | |
659 MakeRef() | |
660 assert_equal('some thing', g:Ref('thing')) | |
661 unlet g:Ref | |
662 enddef | |
663 | |
664 | |
653 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 665 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |