fix: find_var_ht_dict

This commit is contained in:
Jakub Łuczyński 2020-02-10 11:17:22 +01:00
parent e50b545676
commit bae1738bce

View File

@ -8541,6 +8541,7 @@ static hashtab_T *find_var_ht_dict(const char *name, const size_t name_len,
const char **varname, dict_T **d)
{
hashitem_T *hi;
funccall_T *funccal = get_funccal();
*d = NULL;
if (name_len == 0) {
@ -8560,10 +8561,10 @@ static hashtab_T *find_var_ht_dict(const char *name, const size_t name_len,
return &compat_hashtab;
}
if (current_funccal == NULL) {
if (funccal == NULL) { // global variable
*d = &globvardict;
} else {
*d = &get_funccal()->l_vars; // l: variable
} else { // l: variable
*d = &funccal->l_vars;
}
goto end;
}
@ -8586,10 +8587,10 @@ static hashtab_T *find_var_ht_dict(const char *name, const size_t name_len,
*d = curtab->tp_vars;
} else if (*name == 'v') { // v: variable
*d = &vimvardict;
} else if (*name == 'a' && current_funccal != NULL) { // function argument
*d = &get_funccal()->l_avars;
} else if (*name == 'l' && current_funccal != NULL) { // local variable
*d = &get_funccal()->l_vars;
} else if (*name == 'a' && funccal != NULL) { // function argument
*d = &funccal->l_avars;
} else if (*name == 'l' && funccal != NULL) { // local variable
*d = &funccal->l_vars;
} else if (*name == 's' // script variable
&& current_sctx.sc_sid > 0
&& current_sctx.sc_sid <= ga_scripts.ga_len) {