forked from aniani/vim
patch 8.2.2188: Vim9: crash when calling global function from :def function
Problem: Vim9: crash when calling global function from :def function.
Solution: Set the outer context. Define the partial for the context on the
original function. Use a refcount to keep track of which ufunc is
using a dfunc. (closes #7525)
This commit is contained in:
@@ -299,6 +299,7 @@ def Test_nested_global_function()
|
||||
Outer()
|
||||
END
|
||||
CheckScriptFailure(lines, "E122:")
|
||||
delfunc g:Inner
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
@@ -1565,6 +1566,25 @@ def Test_global_closure()
|
||||
bwipe!
|
||||
enddef
|
||||
|
||||
def Test_global_closure_called_directly()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Outer()
|
||||
var x = 1
|
||||
def g:Inner()
|
||||
var y = x
|
||||
x += 1
|
||||
assert_equal(1, y)
|
||||
enddef
|
||||
g:Inner()
|
||||
assert_equal(2, x)
|
||||
enddef
|
||||
Outer()
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
delfunc g:Inner
|
||||
enddef
|
||||
|
||||
def Test_failure_in_called_function()
|
||||
# this was using the frame index as the return value
|
||||
var lines =<< trim END
|
||||
|
||||
Reference in New Issue
Block a user