diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-12 17:42:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-12 17:42:55 +0100 |
commit | 7ebcba61b20d25d23109fff73d0346ad44ba1b3b (patch) | |
tree | 4f600e5ca802400fa590f2222ebbab5b71445fa3 /src/scriptfile.c | |
parent | 9b24dfcb9f676e7f7a09a9062f0d05b2104a87eb (diff) | |
download | vim-git-7ebcba61b20d25d23109fff73d0346ad44ba1b3b.tar.gz |
patch 8.2.0114: info about sourced scripts is scatteredv8.2.0114
Problem: Info about sourced scripts is scattered.
Solution: Use scriptitem_T for info about a script, including s: variables.
Drop ga_scripts.
Diffstat (limited to 'src/scriptfile.c')
-rw-r--r-- | src/scriptfile.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c index a1755416b..a574bf665 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -1236,7 +1236,7 @@ do_source( save_current_sctx = current_sctx; current_sctx.sc_lnum = 0; - current_sctx.sc_version = 1; + current_sctx.sc_version = 1; // default script version // Check if this script was sourced before to finds its SID. // If it's new, generate a new SID. @@ -1272,6 +1272,10 @@ do_source( { ++script_items.ga_len; SCRIPT_ITEM(script_items.ga_len).sn_name = NULL; + SCRIPT_ITEM(script_items.ga_len).sn_version = 1; + + // Allocate the local script variables to use for this script. + new_script_vars(script_items.ga_len); # ifdef FEAT_PROFILE SCRIPT_ITEM(script_items.ga_len).sn_prof_on = FALSE; # endif @@ -1289,9 +1293,6 @@ do_source( else si->sn_dev_valid = FALSE; # endif - - // Allocate the local script variables to use for this script. - new_script_vars(current_sctx.sc_sid); } # ifdef FEAT_PROFILE @@ -1483,6 +1484,8 @@ free_scriptnames(void) for (i = script_items.ga_len; i > 0; --i) { + // the variables themselves are cleared in evalvars_clear() + vim_free(SCRIPT_ITEM(i).sn_vars); vim_free(SCRIPT_ITEM(i).sn_name); # ifdef FEAT_PROFILE ga_clear(&SCRIPT_ITEM(i).sn_prl_ga); @@ -1791,7 +1794,10 @@ ex_scriptversion(exarg_T *eap UNUSED) else if (nr > 4) semsg(_("E999: scriptversion not supported: %d"), nr); else + { current_sctx.sc_version = nr; + SCRIPT_ITEM(current_sctx.sc_sid).sn_version = nr; + } #endif } |