0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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 #8996)
This commit is contained in:
Bram Moolenaar
2021-10-15 00:18:37 +01:00
parent 0a7984af56
commit a06758dd38
3 changed files with 8 additions and 4 deletions

View File

@@ -978,8 +978,9 @@ find_typval_in_script(typval_T *dest)
// 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)
// 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;