diff src/ex_cmds2.c @ 15008:67e3103d6e18 v8.1.0515

patch 8.1.0515: reloading a script gives errors for existing functions commit https://github.com/vim/vim/commit/ded5f1bed7ff2d138b3ee0f9610d17290b62692d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 10 17:33:29 2018 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Nov 2018 17:45:06 +0100
parents 9ae60773dd03
children 1783c0b6bc2e
line wrap: on
line diff
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -4344,6 +4344,7 @@ do_source(
 #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 @@ do_source(
      * 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);