summaryrefslogtreecommitdiffstats
path: root/src/evalvars.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/evalvars.c')
-rw-r--r--src/evalvars.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index 2455046d93..f3253551f2 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2882,7 +2882,7 @@ vars_clear_ext(hashtab_T *ht, int free_val)
}
}
hash_clear(ht);
- ht->ht_used = 0;
+ hash_init(ht);
}
/*
@@ -3142,30 +3142,10 @@ set_var_const(
if (flags & ASSIGN_CONST)
di->di_flags |= DI_FLAGS_LOCK;
+ // A Vim9 script-local variable is also added to sn_all_vars and
+ // sn_var_vals.
if (is_script_local && vim9script)
- {
- scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
-
- // Store a pointer to the typval_T, so that it can be found by
- // index instead of using a hastab lookup.
- if (ga_grow(&si->sn_var_vals, 1) == OK)
- {
- svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
- + si->sn_var_vals.ga_len;
- sv->sv_name = di->di_key;
- sv->sv_tv = &di->di_tv;
- if (type == NULL)
- sv->sv_type = typval2type(tv, &si->sn_type_list);
- else
- sv->sv_type = type;
- sv->sv_const = (flags & ASSIGN_CONST);
- sv->sv_export = is_export;
- ++si->sn_var_vals.ga_len;
-
- // let ex_export() know the export worked.
- is_export = FALSE;
- }
- }
+ add_vim9_script_var(di, tv, type);
}
if (copy || tv->v_type == VAR_NUMBER || tv->v_type == VAR_FLOAT)