1
0
forked from aniani/vim

patch 8.2.0056: execution stack is incomplete and inefficient

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.
This commit is contained in:
Bram Moolenaar
2019-12-29 23:04:25 +01:00
parent 257a396879
commit 1a47ae32cd
23 changed files with 385 additions and 240 deletions

View File

@@ -266,8 +266,15 @@ EXTERN int lines_left INIT(= -1); // lines left for listing
EXTERN int msg_no_more INIT(= FALSE); // don't use more prompt, truncate
// messages
EXTERN char_u *sourcing_name INIT( = NULL);// name of error message source
EXTERN linenr_T sourcing_lnum INIT(= 0); // line number of the source file
/*
* Stack of execution contexts. Each entry is an estack_T.
* Current context is at ga_len - 1.
*/
EXTERN garray_T exestack INIT(= {0 COMMA 0 COMMA sizeof(estack_T) COMMA 50 COMMA NULL});
// name of error message source
#define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name)
// line number in the message source or zero
#define SOURCING_LNUM (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_lnum)
#ifdef FEAT_EVAL
EXTERN int ex_nesting_level INIT(= 0); // nesting level