1
0
forked from aniani/vim

patch 8.2.1778: Vim9: returning from a partial call clears outer context

Problem:    Vim9: returning from a partial call clears outer context, causing
            a crash.
Solution:   Put the outer context in the stack frame. (closes #7044)
This commit is contained in:
Bram Moolenaar
2020-10-01 13:01:34 +02:00
parent 55759b5228
commit 5366e1aecf
4 changed files with 31 additions and 6 deletions

View File

@@ -1384,6 +1384,21 @@ def Test_nested_closure_fails()
CheckScriptFailure(lines, 'E1012:')
enddef
def Test_nested_lambda()
var lines =<< trim END
vim9script
def Func()
var x = 4
var Lambda1 = {-> 7}
var Lambda2 = {-> [Lambda1(), x]}
var res = Lambda2()
assert_equal([7, 4], res)
enddef
Func()
END
CheckScriptSuccess(lines)
enddef
def Test_sort_return_type()
var res: list<number>
res = [1, 2, 3]->sort()