0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.2614: Vim9: function is deleted while executing

Problem:    Vim9: function is deleted while executing.
Solution:   increment the call count, when more than zero do not delete the
            function but mark it as dead. (closes #7977)
This commit is contained in:
Bram Moolenaar
2021-03-17 15:03:04 +01:00
parent 6ccfd99b92
commit c970e4225b
4 changed files with 65 additions and 9 deletions

View File

@@ -1561,6 +1561,35 @@ def Test_script_reload_change_type()
delete('Xreload.vim')
enddef
" Define CallFunc so that the test can be compiled
command CallFunc echo 'nop'
def Test_script_reload_from_function()
var lines =<< trim END
vim9script
if exists('g:loaded')
finish
endif
g:loaded = 1
delcommand CallFunc
command CallFunc Func()
def Func()
so /tmp/test.vim
g:didTheFunc = 1
enddef
END
writefile(lines, 'XreloadFunc.vim')
source XreloadFunc.vim
CallFunc
assert_equal(1, g:didTheFunc)
delete('XreloadFunc.vim')
delcommand CallFunc
unlet g:loaded
unlet g:didTheFunc
enddef
def Test_script_var_shadows_function()
var lines =<< trim END
vim9script