Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 24146:03fc95628eb0 v8.2.2614
patch 8.2.2614: Vim9: function is deleted while executing
Commit: https://github.com/vim/vim/commit/c970e4225b68ff8650ff23df09e04246c147fca3
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 17 15:03:04 2021 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Mar 2021 15:15:03 +0100 |
parents | e8b21a3bb0d5 |
children | 0edc315f2d0c |
comparison
equal
deleted
inserted
replaced
24145:4d64b2bee122 | 24146:03fc95628eb0 |
---|---|
1557 source Xreload.vim | 1557 source Xreload.vim |
1558 assert_fails('echo g:GetStr()', 'E1150:') | 1558 assert_fails('echo g:GetStr()', 'E1150:') |
1559 | 1559 |
1560 delfunc g:GetStr | 1560 delfunc g:GetStr |
1561 delete('Xreload.vim') | 1561 delete('Xreload.vim') |
1562 enddef | |
1563 | |
1564 " Define CallFunc so that the test can be compiled | |
1565 command CallFunc echo 'nop' | |
1566 | |
1567 def Test_script_reload_from_function() | |
1568 var lines =<< trim END | |
1569 vim9script | |
1570 | |
1571 if exists('g:loaded') | |
1572 finish | |
1573 endif | |
1574 g:loaded = 1 | |
1575 delcommand CallFunc | |
1576 command CallFunc Func() | |
1577 def Func() | |
1578 so /tmp/test.vim | |
1579 g:didTheFunc = 1 | |
1580 enddef | |
1581 END | |
1582 writefile(lines, 'XreloadFunc.vim') | |
1583 source XreloadFunc.vim | |
1584 CallFunc | |
1585 assert_equal(1, g:didTheFunc) | |
1586 | |
1587 delete('XreloadFunc.vim') | |
1588 delcommand CallFunc | |
1589 unlet g:loaded | |
1590 unlet g:didTheFunc | |
1562 enddef | 1591 enddef |
1563 | 1592 |
1564 def Test_script_var_shadows_function() | 1593 def Test_script_var_shadows_function() |
1565 var lines =<< trim END | 1594 var lines =<< trim END |
1566 vim9script | 1595 vim9script |