0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.2687: Vim9: cannot use "const" for global variable in :def function

Problem:    Vim9: cannot use "const" for global variable in :def function.
Solution:   Do allow using :const for a global variable. (closes #8030)
This commit is contained in:
Bram Moolenaar
2021-04-01 19:42:48 +02:00
parent ce0b75711a
commit d877a5700f
4 changed files with 27 additions and 2 deletions

View File

@@ -963,9 +963,12 @@ check_for_number(typval_T *tv)
store_var(char_u *name, typval_T *tv)
{
funccal_entry_T entry;
int flags = ASSIGN_DECL;
if (tv->v_lock)
flags |= ASSIGN_CONST;
save_funccal(&entry);
set_var_const(name, NULL, tv, FALSE, ASSIGN_DECL, 0);
set_var_const(name, NULL, tv, FALSE, flags, 0);
restore_funccal();
}