patch 8.2.2223: Vim9: Reloading marks a :def function as deleted

Problem:    Vim9: Reloading marks a :def function as deleted.
Solution:   Clear the function contents but keep the index.
This commit is contained in:
Bram Moolenaar
2020-12-26 17:43:08 +01:00
parent 2b32700dab
commit cdc40c43f1
5 changed files with 18 additions and 38 deletions
-17
View File
@@ -219,23 +219,6 @@ some point when loaded again. E.g. when a buffer local option is set: >
def g:SomeFunc()
....
There is one gotcha: If a compiled function is replaced and it is called from
another compiled function that is not replaced, it will try to call the
function from before it was replaced, which no longer exists. This doesn't
work: >
vimscript noclear
def ReplaceMe()
echo 'function redefined every time'
enddef
if exists('s:loaded') | finish | endif
var s:loaded = true
def NotReplaced()
ReplaceMe() # Error if ReplaceMe() was redefined
enddef
Variable declarations with :var, :final and :const ~
*vim9-declaration* *:var*