]> granicus.if.org Git - vim/commitdiff
patch 8.2.0279: Vim9: no test for deleted :def function v8.2.0279
authorBram Moolenaar <Bram@vim.org>
Wed, 19 Feb 2020 14:46:48 +0000 (15:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 19 Feb 2020 14:46:48 +0000 (15:46 +0100)
Problem:    Vim9: no test for deleted :def function.
Solution:   Add a test.  Clear uf_cleared flag when redefining a function.

src/testdir/test_vim9_script.vim
src/userfunc.c
src/version.c

index 892806f39a622ef8b84ce27d39890f8e7238d7e3..899a32aa6e03b619c666faff2608a89deb3a1528 100644 (file)
@@ -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
index fc2161f51d4862489c00d5a58e04bc8474f18dc8..9ff78c29b5418508bb3bd37a4b49d8b0f2412d2b 100644 (file)
@@ -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)
index d74b0fa7842739a5aed184526cf232c1843c6937..d748416caee68bb7b5eff62c5c17608f44807f78 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    279,
 /**/
     278,
 /**/