Problem: Vim9: entry for loop variable is created every round.
Solution: Only create the entry once. (closes #8996)
goto failed;
}
- if (var_in_vim9script)
+ if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0)
{
where_T where = WHERE_INIT;
goto failed;
}
- if (var_check_permission(di, name) == FAIL)
+ if ((flags & ASSIGN_FOR_LOOP) == 0
+ && var_check_permission(di, name) == FAIL)
goto failed;
}
else
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3511,
/**/
3510,
/**/
// 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;