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

patch 8.2.1434: Vim9: crash when lambda uses outer function argument

Problem:    Vim9: crash when lambda uses outer function argument.
Solution:   Set the flag that the outer context is used.
This commit is contained in:
Bram Moolenaar
2020-08-12 19:42:01 +02:00
parent ba60cc45e7
commit fd77748df2
3 changed files with 18 additions and 0 deletions

View File

@@ -1443,6 +1443,16 @@ def LambdaWithComments(): func
}
enddef
def LambdaUsingArg(x: number): func
return {->
# some comment
x == 1
# some comment
||
x == 2
}
enddef
def Test_expr7_lambda()
let La = { -> 'result'}
assert_equal('result', La())
@@ -1481,6 +1491,9 @@ def Test_expr7_lambda()
assert_equal(true, LambdaWithComments()(2))
assert_equal(false, LambdaWithComments()(3))
assert_equal(false, LambdaUsingArg(0)())
assert_equal(true, LambdaUsingArg(1)())
call CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:')
enddef