mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.0114: info about sourced scripts is scattered
Problem: Info about sourced scripts is scattered. Solution: Use scriptitem_T for info about a script, including s: variables. Drop ga_scripts.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user