Patch 8.2.2681

4 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 31, 2021, 3:48:04 PM3/31/21
to vim...@googlegroups.com

Patch 8.2.2681
Problem: Vim9: test fails for redeclaring script variable.
Solution: It's OK to assign to an existing script variable in legacy.
Files: src/evalvars.c


*** ../vim-8.2.2680/src/evalvars.c 2021-03-31 21:07:21.312591129 +0200
--- src/evalvars.c 2021-03-31 21:45:43.403242582 +0200
***************
*** 3219,3234 ****
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;
--- 3219,3235 ----
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;

// check the type and adjust to bool if needed
where.wt_index = var_idx;
where.wt_variable = TRUE;
*** ../vim-8.2.2680/src/version.c 2021-03-31 21:07:21.312591129 +0200
--- src/version.c 2021-03-31 21:47:21.215034698 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2681,
/**/

--
Seen it all, done it all, can't remember most of it.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages