diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-29 23:04:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-29 23:04:25 +0100 |
commit | 1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 (patch) | |
tree | 8f5dc27f3eeea927ad3ca8de42fe0df06a041dd5 /src/structs.h | |
parent | 257a396879ff67a0482841a39237f30a8e1e27c5 (diff) | |
download | vim-git-1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506.tar.gz |
patch 8.2.0056: execution stack is incomplete and inefficientv8.2.0056
Problem: Execution stack is incomplete and inefficient.
Solution: Introduce a proper execution stack and use it instead of
sourcing_name/sourcing_lnum. Create a string only when used.
Diffstat (limited to 'src/structs.h')
-rw-r--r-- | src/structs.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/structs.h b/src/structs.h index 9f1d479ce..c995d4beb 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1496,6 +1496,8 @@ typedef struct // used for s: variables int uf_refcount; // reference count, see func_name_refcount() funccall_T *uf_scoped; // l: local variables for closure + char_u *uf_name_exp; // if "uf_name[]" starts with SNR the name with + // "<SNR>" as a string, otherwise NULL char_u uf_name[1]; // name of function (actually longer); can // start with <SNR>123_ (<SNR> is K_SPECIAL // KS_EXTRA KE_SNR) @@ -1665,6 +1667,38 @@ struct partial_S dict_T *pt_dict; // dict for "self" }; +typedef struct AutoPatCmd_S AutoPatCmd; + +/* + * Entry in the execution stack "exestack". + */ +typedef enum { + ETYPE_TOP, // toplevel + ETYPE_SCRIPT, // sourcing script, use es_info.sctx + ETYPE_UFUNC, // user function, use es_info.ufunc + ETYPE_AUCMD, // autocomand, use es_info.aucmd + ETYPE_MODELINE, // modeline, use es_info.sctx + ETYPE_EXCEPT, // exception, use es_info.exception + ETYPE_ARGS, // command line argument + ETYPE_ENV, // environment variable + ETYPE_INTERNAL, // internal operation + ETYPE_SPELL, // loading spell file +} etype_T; + +typedef struct { + long es_lnum; // replaces "sourcing_lnum" + char_u *es_name; // replaces "sourcing_name" + etype_T es_type; + union { + sctx_T *sctx; // script and modeline info +#if defined(FEAT_EVAL) + ufunc_T *ufunc; // function info +#endif + AutoPatCmd *aucmd; // autocommand info + except_T *except; // exception info + } es_info; +} estack_T; + // Information returned by get_tty_info(). typedef struct { int backspace; // what the Backspace key produces |