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.
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 3a4bce8..d6b6f5b 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -4344,6 +4344,7 @@
#ifdef FEAT_EVAL
sctx_T save_current_sctx;
static scid_T last_current_SID = 0;
+ static int last_current_SID_seq = 0;
funccal_entry_T funccalp_entry;
int save_debug_break_level = debug_break_level;
scriptitem_T *si = NULL;
@@ -4508,11 +4509,11 @@
* Also starts profiling timer for nested script. */
save_funccal(&funccalp_entry);
- /*
- * Check if this script was sourced before to finds its SID.
- * If it's new, generate a new SID.
- */
+ // Check if this script was sourced before to finds its SID.
+ // If it's new, generate a new SID.
+ // Always use a new sequence number.
save_current_sctx = current_sctx;
+ current_sctx.sc_seq = ++last_current_SID_seq;
current_sctx.sc_lnum = 0;
# ifdef UNIX
stat_ok = (mch_stat((char *)fname_exp, &st) >= 0);