Mercurial > vim
comparison src/vim9script.c @ 25955:4003fc2340dc v8.2.3511
patch 8.2.3511: Vim9: entry for loop variable is created every round
Commit: https://github.com/vim/vim/commit/a06758dd38851f022d270dd5102efbe1049d4712
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 15 00:18:37 2021 +0100
patch 8.2.3511: Vim9: entry for loop variable is created every round
Problem: Vim9: entry for loop variable is created every round.
Solution: Only create the entry once. (closes https://github.com/vim/vim/issues/8996)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 15 Oct 2021 01:30:03 +0200 |
parents | 33ebec729787 |
children | 7351926fbe9e |
comparison
equal
deleted
inserted
replaced
25954:336f67070095 | 25955:4003fc2340dc |
---|---|
976 | 976 |
977 if (si->sn_version != SCRIPT_VERSION_VIM9) | 977 if (si->sn_version != SCRIPT_VERSION_VIM9) |
978 // legacy script doesn't store variable types | 978 // legacy script doesn't store variable types |
979 return NULL; | 979 return NULL; |
980 | 980 |
981 // Find the svar_T in sn_var_vals. | 981 // Find the svar_T in sn_var_vals. Start at the end, in a for loop the |
982 for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx) | 982 // variable was added at the end. |
983 for (idx = si->sn_var_vals.ga_len - 1; idx >= 0; --idx) | |
983 { | 984 { |
984 svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; | 985 svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; |
985 | 986 |
986 // If "sv_name" is NULL the variable was hidden when leaving a block, | 987 // If "sv_name" is NULL the variable was hidden when leaving a block, |
987 // don't check "sv_tv" then, it might be used for another variable now. | 988 // don't check "sv_tv" then, it might be used for another variable now. |