To: vim_dev@googlegroups.com Subject: Patch 8.2.3511 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3511 Problem: Vim9: entry for loop variable is created every round. Solution: Only create the entry once. (closes #8996) Files: src/evalvars.c, src/vim9script.c *** ../vim-8.2.3510/src/evalvars.c 2021-09-11 22:07:39.796286455 +0100 --- src/evalvars.c 2021-10-15 00:08:20.253141052 +0100 *************** *** 3319,3325 **** goto failed; } ! if (var_in_vim9script) { where_T where = WHERE_INIT; --- 3319,3325 ---- goto failed; } ! if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0) { where_T where = WHERE_INIT; *************** *** 3331,3337 **** goto failed; } ! if (var_check_permission(di, name) == FAIL) goto failed; } else --- 3331,3338 ---- goto failed; } ! if ((flags & ASSIGN_FOR_LOOP) == 0 ! && var_check_permission(di, name) == FAIL) goto failed; } else *** ../vim-8.2.3510/src/vim9script.c 2021-09-08 11:31:31.862351834 +0100 --- src/vim9script.c 2021-10-15 00:08:53.369648781 +0100 *************** *** 978,985 **** // legacy script doesn't store variable types return NULL; ! // Find the svar_T in sn_var_vals. ! for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx) { svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; --- 978,986 ---- // legacy script doesn't store variable types return NULL; ! // Find the svar_T in sn_var_vals. Start at the end, in a for loop the ! // variable was added at the end. ! for (idx = si->sn_var_vals.ga_len - 1; idx >= 0; --idx) { svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; *** ../vim-8.2.3510/src/version.c 2021-10-14 21:27:50.646253845 +0100 --- src/version.c 2021-10-15 00:17:38.613656852 +0100 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3511, /**/ -- hundred-and-one symptoms of being an internet addict: 155. You forget to eat because you're too busy surfing the net. /// Bram Moolenaar -- Bram@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 ///