1
0
forked from aniani/vim

patch 8.2.2321: Vim9: cannot nest closures

Problem:    Vim9: cannot nest closures.
Solution:   Add the nesting level to ISN_LOADOUTER and ISN_STOREOUTER.
            (closes #7150, closes #7635)
This commit is contained in:
Bram Moolenaar
2021-01-10 14:02:28 +01:00
parent cff40ff986
commit ab360526ef
7 changed files with 177 additions and 43 deletions

View File

@@ -1812,6 +1812,16 @@ def Test_list_lambda()
assert_match('def <lambda>\d\+(_: any, ...): number\n1 return 0\n enddef', body)
enddef
def DoFilterThis(a: string): list<string>
# closure nested inside another closure using argument
var Filter = (l) => filter(l, (_, v) => stridx(v, a) == 0)
return ['x', 'y', 'a', 'x2', 'c']->Filter()
enddef
def Test_nested_closure_using_argument()
assert_equal(['x', 'x2'], DoFilterThis('x'))
enddef
func Test_silent_echo()
CheckScreendump