fix: made eval_lavars_used global

This commit is contained in:
Jakub Łuczyński 2020-02-11 12:18:22 +01:00
parent 9d7ce03ef1
commit 1e0a9b2690
3 changed files with 8 additions and 5 deletions

View File

@ -81,8 +81,8 @@ static ScopeDictDictItem globvars_var;
*/
static hashtab_T compat_hashtab;
// Used for checking if local variables or arguments used in a lambda.
static int *eval_lavars_used = NULL;
/// Used for checking if local variables or arguments used in a lambda.
bool *eval_lavars_used = NULL;
/*
* Array to hold the hashtab with variables local to each sourced script.
@ -8232,7 +8232,7 @@ int get_var_tv(
}
/// Check if variable "name[len]" is a local variable or an argument.
/// If so, "*eval_lavars_used" is set to TRUE.
/// If so, "*eval_lavars_used" is set to true.
static void check_vars(const char *name, size_t len)
{
if (eval_lavars_used == NULL) {

View File

@ -232,6 +232,9 @@ typedef enum {
kDictListItems, ///< List dictionary contents: [keys, values].
} DictListType;
// Used for checking if local variables or arguments used in a lambda.
extern bool *eval_lavars_used;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "eval.h.generated.h"
#endif

View File

@ -159,8 +159,8 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate)
char_u *start = skipwhite(*arg + 1);
char_u *s, *e;
static int lambda_no = 0;
int *old_eval_lavars = eval_lavars_used;
int eval_lavars = false;
bool *old_eval_lavars = eval_lavars_used;
bool eval_lavars = false;
// First, check if this is a lambda expression. "->" must exists.
ret = get_function_args(&start, '-', NULL, NULL, true);