1
0
forked from aniani/vim

patch 8.2.2681: Vim9: test fails for redeclaring script variable

Problem:    Vim9: test fails for redeclaring script variable.
Solution:   It's OK to assign to an existing script variable in legacy.
This commit is contained in:
Bram Moolenaar
2021-03-31 21:47:33 +02:00
parent e535db86e7
commit 12be734faf
2 changed files with 9 additions and 6 deletions

View File

@@ -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;