diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-31 21:47:33 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-31 21:47:33 +0200 |
commit | 12be734faffe1da04dfa9098e73abaa864204bc5 (patch) | |
tree | 7bf5934ec075e0e3adec59ee9aee67dd8e34f6ca /src/evalvars.c | |
parent | e535db86e76db5e8fcd2fa8ad54050e171e8adc3 (diff) | |
download | vim-git-12be734faffe1da04dfa9098e73abaa864204bc5.tar.gz |
patch 8.2.2681: Vim9: test fails for redeclaring script variablev8.2.2681
Problem: Vim9: test fails for redeclaring script variable.
Solution: It's OK to assign to an existing script variable in legacy.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index a48245333..67abdcb1d 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -3219,16 +3219,17 @@ set_var_const( goto failed; } + if (is_script_local && vim9script + && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0) + { + semsg(_(e_redefining_script_item_str), name); + goto failed; + } + if (var_in_vim9script) { where_T where; - if ((flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0) - { - semsg(_(e_redefining_script_item_str), name); - goto failed; - } - // check the type and adjust to bool if needed where.wt_index = var_idx; where.wt_variable = TRUE; |