]> granicus.if.org Git - vim/commitdiff
patch 8.2.2681: Vim9: test fails for redeclaring script variable v8.2.2681
authorBram Moolenaar <Bram@vim.org>
Wed, 31 Mar 2021 19:47:33 +0000 (21:47 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 31 Mar 2021 19:47:33 +0000 (21:47 +0200)
Problem:    Vim9: test fails for redeclaring script variable.
Solution:   It's OK to assign to an existing script variable in legacy.

src/evalvars.c
src/version.c

index a482453331e3e9cc7877e54969971983f966d534..67abdcb1d57507a53c6d85c47a564aef7597697f 100644 (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;
index d448b948028d9b15174276950248e9a410b6e090..104073d316cc65725e6848d36fb84c2ac6fff701 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2681,
 /**/
     2680,
 /**/