vim-patch:8.1.0515: reloading a script gives errors for existing functions

Problem:    Reloading a script gives errors for existing functions.
Solution:   Allow redefining a function once when reloading a script.
ded5f1bed7
This commit is contained in:
erw7
2019-08-29 13:07:03 +09:00
parent e4a4786241
commit 9db60b06a1
9 changed files with 51 additions and 7 deletions

View File

@@ -21504,7 +21504,11 @@ void ex_function(exarg_T *eap)
fp = find_func(name);
if (fp != NULL) {
if (!eap->forceit) {
// Function can be replaced with "function!" and when sourcing the
// same script again, but only once.
if (!eap->forceit
&& (fp->uf_script_ctx.sc_sid != current_sctx.sc_sid
|| fp->uf_script_ctx.sc_seq == current_sctx.sc_seq)) {
emsg_funcname(e_funcexts, name);
goto erret;
}