summaryrefslogtreecommitdiff
path: root/src/evalvars.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-31 21:47:33 +0200
committerBram Moolenaar <Bram@vim.org>2021-03-31 21:47:33 +0200
commit12be734faffe1da04dfa9098e73abaa864204bc5 (patch)
tree7bf5934ec075e0e3adec59ee9aee67dd8e34f6ca /src/evalvars.c
parente535db86e76db5e8fcd2fa8ad54050e171e8adc3 (diff)
downloadvim-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.c13
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;