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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211014231945.F26DBC80053%40moolenaar.net.

Raspunde prin e-mail lui