Mercurial > vim
comparison src/evalvars.c @ 22551:86a115a80262 v8.2.1824
patch 8.2.1824: Vim9: variables at the script level escape their scope
Commit: https://github.com/vim/vim/commit/fcdc5d83fbfd7ddce634769ea902e58c87f27f20
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 10 19:07:09 2020 +0200
patch 8.2.1824: Vim9: variables at the script level escape their scope
Problem: Vim9: variables at the script level escape their scope.
Solution: When leaving a scope remove variables declared in it.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Oct 2020 19:15:04 +0200 |
parents | 2df99e237965 |
children | 209c7aa56325 |
comparison
equal
deleted
inserted
replaced
22550:d61c22faf4be | 22551:86a115a80262 |
---|---|
172 static void list_tab_vars(int *first); | 172 static void list_tab_vars(int *first); |
173 static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first); | 173 static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first); |
174 static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, int flags, char_u *endchars, char_u *op); | 174 static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, int flags, char_u *endchars, char_u *op); |
175 static int do_unlet_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie); | 175 static int do_unlet_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie); |
176 static int do_lock_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie); | 176 static int do_lock_var(lval_T *lp, char_u *name_end, exarg_T *eap, int deep, void *cookie); |
177 static void delete_var(hashtab_T *ht, hashitem_T *hi); | |
178 static void list_one_var(dictitem_T *v, char *prefix, int *first); | 177 static void list_one_var(dictitem_T *v, char *prefix, int *first); |
179 static void list_one_var_a(char *prefix, char_u *name, int type, char_u *string, int *first); | 178 static void list_one_var_a(char *prefix, char_u *name, int type, char_u *string, int *first); |
180 | 179 |
181 /* | 180 /* |
182 * Initialize global and vim special variables | 181 * Initialize global and vim special variables |
2888 | 2887 |
2889 /* | 2888 /* |
2890 * Delete a variable from hashtab "ht" at item "hi". | 2889 * Delete a variable from hashtab "ht" at item "hi". |
2891 * Clear the variable value and free the dictitem. | 2890 * Clear the variable value and free the dictitem. |
2892 */ | 2891 */ |
2893 static void | 2892 void |
2894 delete_var(hashtab_T *ht, hashitem_T *hi) | 2893 delete_var(hashtab_T *ht, hashitem_T *hi) |
2895 { | 2894 { |
2896 dictitem_T *di = HI2DI(hi); | 2895 dictitem_T *di = HI2DI(hi); |
2897 | 2896 |
2898 hash_remove(ht, hi); | 2897 hash_remove(ht, hi); |