0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2760: Vim9: no error for changing a for loop variable

Problem:    Vim9: no error for changing a for loop variable.
Solution:   Make the loop variable read-only. (issue #8102)
This commit is contained in:
Bram Moolenaar
2021-04-13 21:48:03 +02:00
parent f2253963c2
commit f6a8d420a8
6 changed files with 41 additions and 12 deletions

View File

@@ -7590,7 +7590,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
// Reserve a variable to store "var".
// TODO: check for type
var_lvar = reserve_local(cctx, arg, varlen, FALSE, &t_any);
var_lvar = reserve_local(cctx, arg, varlen, TRUE, &t_any);
if (var_lvar == NULL)
// out of memory or used as an argument
goto failed;