Mercurial > vim
comparison src/scriptfile.c @ 19108:44c6498535c9 v8.2.0114
patch 8.2.0114: info about sourced scripts is scattered
Commit: https://github.com/vim/vim/commit/7ebcba61b20d25d23109fff73d0346ad44ba1b3b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 12 17:42:55 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Jan 2020 17:45:03 +0100 |
parents | af1eca322b9e |
children | ea3ac1de7704 |
comparison
equal
deleted
inserted
replaced
19107:d66161509163 | 19108:44c6498535c9 |
---|---|
1234 // Also starts profiling timer for nested script. | 1234 // Also starts profiling timer for nested script. |
1235 save_funccal(&funccalp_entry); | 1235 save_funccal(&funccalp_entry); |
1236 | 1236 |
1237 save_current_sctx = current_sctx; | 1237 save_current_sctx = current_sctx; |
1238 current_sctx.sc_lnum = 0; | 1238 current_sctx.sc_lnum = 0; |
1239 current_sctx.sc_version = 1; | 1239 current_sctx.sc_version = 1; // default script version |
1240 | 1240 |
1241 // Check if this script was sourced before to finds its SID. | 1241 // Check if this script was sourced before to finds its SID. |
1242 // If it's new, generate a new SID. | 1242 // If it's new, generate a new SID. |
1243 // Always use a new sequence number. | 1243 // Always use a new sequence number. |
1244 current_sctx.sc_seq = ++last_current_SID_seq; | 1244 current_sctx.sc_seq = ++last_current_SID_seq; |
1270 goto almosttheend; | 1270 goto almosttheend; |
1271 while (script_items.ga_len < current_sctx.sc_sid) | 1271 while (script_items.ga_len < current_sctx.sc_sid) |
1272 { | 1272 { |
1273 ++script_items.ga_len; | 1273 ++script_items.ga_len; |
1274 SCRIPT_ITEM(script_items.ga_len).sn_name = NULL; | 1274 SCRIPT_ITEM(script_items.ga_len).sn_name = NULL; |
1275 SCRIPT_ITEM(script_items.ga_len).sn_version = 1; | |
1276 | |
1277 // Allocate the local script variables to use for this script. | |
1278 new_script_vars(script_items.ga_len); | |
1275 # ifdef FEAT_PROFILE | 1279 # ifdef FEAT_PROFILE |
1276 SCRIPT_ITEM(script_items.ga_len).sn_prof_on = FALSE; | 1280 SCRIPT_ITEM(script_items.ga_len).sn_prof_on = FALSE; |
1277 # endif | 1281 # endif |
1278 } | 1282 } |
1279 si = &SCRIPT_ITEM(current_sctx.sc_sid); | 1283 si = &SCRIPT_ITEM(current_sctx.sc_sid); |
1287 si->sn_ino = st.st_ino; | 1291 si->sn_ino = st.st_ino; |
1288 } | 1292 } |
1289 else | 1293 else |
1290 si->sn_dev_valid = FALSE; | 1294 si->sn_dev_valid = FALSE; |
1291 # endif | 1295 # endif |
1292 | |
1293 // Allocate the local script variables to use for this script. | |
1294 new_script_vars(current_sctx.sc_sid); | |
1295 } | 1296 } |
1296 | 1297 |
1297 # ifdef FEAT_PROFILE | 1298 # ifdef FEAT_PROFILE |
1298 if (do_profiling == PROF_YES) | 1299 if (do_profiling == PROF_YES) |
1299 { | 1300 { |
1481 { | 1482 { |
1482 int i; | 1483 int i; |
1483 | 1484 |
1484 for (i = script_items.ga_len; i > 0; --i) | 1485 for (i = script_items.ga_len; i > 0; --i) |
1485 { | 1486 { |
1487 // the variables themselves are cleared in evalvars_clear() | |
1488 vim_free(SCRIPT_ITEM(i).sn_vars); | |
1486 vim_free(SCRIPT_ITEM(i).sn_name); | 1489 vim_free(SCRIPT_ITEM(i).sn_name); |
1487 # ifdef FEAT_PROFILE | 1490 # ifdef FEAT_PROFILE |
1488 ga_clear(&SCRIPT_ITEM(i).sn_prl_ga); | 1491 ga_clear(&SCRIPT_ITEM(i).sn_prl_ga); |
1489 # endif | 1492 # endif |
1490 } | 1493 } |
1789 if (nr == 0 || *eap->arg != NUL) | 1792 if (nr == 0 || *eap->arg != NUL) |
1790 emsg(_(e_invarg)); | 1793 emsg(_(e_invarg)); |
1791 else if (nr > 4) | 1794 else if (nr > 4) |
1792 semsg(_("E999: scriptversion not supported: %d"), nr); | 1795 semsg(_("E999: scriptversion not supported: %d"), nr); |
1793 else | 1796 else |
1797 { | |
1794 current_sctx.sc_version = nr; | 1798 current_sctx.sc_version = nr; |
1799 SCRIPT_ITEM(current_sctx.sc_sid).sn_version = nr; | |
1800 } | |
1795 #endif | 1801 #endif |
1796 } | 1802 } |
1797 | 1803 |
1798 #if defined(FEAT_EVAL) || defined(PROTO) | 1804 #if defined(FEAT_EVAL) || defined(PROTO) |
1799 /* | 1805 /* |