0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.2635: Vim9: cannot define an inline function

Problem:    Vim9: cannot define an inline function.
Solution:   Make an inline function mostly work.
This commit is contained in:
Bram Moolenaar
2021-03-21 20:53:29 +01:00
parent f90c855c71
commit 7a6eaa06f9
7 changed files with 573 additions and 362 deletions

View File

@@ -1946,6 +1946,25 @@ def Test_expr7_lambda()
CheckScriptSuccess(lines)
enddef
def Test_expr7_lambda_block()
var lines =<< trim END
var Func = (s: string): string => {
return 'hello ' .. s
}
assert_equal('hello there', Func('there'))
var ll = range(3)
var dll = mapnew(ll, (k, v): string => {
if v % 2
return 'yes'
endif
return 'no'
})
assert_equal(['no', 'yes', 'no'], dll)
END
CheckDefAndScriptSuccess(lines)
enddef
def NewLambdaWithComments(): func
return (x) =>
# some comment