diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-19 15:46:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-19 15:46:48 +0100 |
commit | 63ce4849efa54d3980446ad337d0e1248ec86182 (patch) | |
tree | b17d139d0c7120682f1689c6f677362b1e880cc6 | |
parent | 9ae3bbdb960c3bed20a6db75a75a0a567d570bea (diff) | |
download | vim-git-63ce4849efa54d3980446ad337d0e1248ec86182.tar.gz |
patch 8.2.0279: Vim9: no test for deleted :def functionv8.2.0279
Problem: Vim9: no test for deleted :def function.
Solution: Add a test. Clear uf_cleared flag when redefining a function.
-rw-r--r-- | src/testdir/test_vim9_script.vim | 21 | ||||
-rw-r--r-- | src/userfunc.c | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 892806f39..899a32aa6 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -477,5 +477,26 @@ def Test_if_elseif_else() assert_equal('three', IfElse(3)) enddef +def Test_delfunc() + let lines =<< trim END + vim9script + def GoneSoon() + echo 'hello' + enddef + + def CallGoneSoon() + GoneSoon() + enddef + + delfunc GoneSoon + CallGoneSoon() + END + writefile(lines, 'XToDelFunc') + assert_fails('so XToDelFunc', 'E933') + assert_fails('so XToDelFunc', 'E933') + + delete('XToDelFunc') +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/userfunc.c b/src/userfunc.c index fc2161f51..9ff78c29b 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -3053,6 +3053,7 @@ ex_function(exarg_T *eap) flags |= FC_SANDBOX; fp->uf_flags = flags; fp->uf_calls = 0; + fp->uf_cleared = FALSE; fp->uf_script_ctx = current_sctx; fp->uf_script_ctx.sc_lnum += sourcing_lnum_top; if (is_export) diff --git a/src/version.c b/src/version.c index d74b0fa78..d748416ca 100644 --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 279, +/**/ 278, /**/ 277, |