comparison src/vim9compile.c @ 26238:14b4c778b61e v8.2.3650

patch 8.2.3650: Vim9: for loop variable can be a list member Commit: https://github.com/vim/vim/commit/3b3755fe19e9ded2a1c45f14b2c6fa065bcaf2c6 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 22 20:10:18 2021 +0000 patch 8.2.3650: Vim9: for loop variable can be a list member Problem: Vim9: for loop variable can be a list member. Solution: Check for valid variable name. (closes https://github.com/vim/vim/issues/9179)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Nov 2021 21:15:03 +0100
parents e861c5aaedd8
children 36361f080ffd
comparison
equal deleted inserted replaced
26237:83c695dd5355 26238:14b4c778b61e
8218 } 8218 }
8219 8219
8220 for (idx = 0; idx < var_count; ++idx) 8220 for (idx = 0; idx < var_count; ++idx)
8221 { 8221 {
8222 assign_dest_T dest = dest_local; 8222 assign_dest_T dest = dest_local;
8223 int opt_flags = 0; 8223 int opt_flags = 0;
8224 int vimvaridx = -1; 8224 int vimvaridx = -1;
8225 type_T *type = &t_any; 8225 type_T *type = &t_any;
8226 type_T *lhs_type = &t_any; 8226 type_T *lhs_type = &t_any;
8227 where_T where = WHERE_INIT; 8227 where_T where = WHERE_INIT;
8228 8228
8229 p = skip_var_one(arg, FALSE); 8229 p = skip_var_one(arg, FALSE);
8253 if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) 8253 if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL)
8254 goto failed; 8254 goto failed;
8255 } 8255 }
8256 else 8256 else
8257 { 8257 {
8258 if (!valid_varname(arg, varlen, FALSE))
8259 goto failed;
8258 if (lookup_local(arg, varlen, NULL, cctx) == OK) 8260 if (lookup_local(arg, varlen, NULL, cctx) == OK)
8259 { 8261 {
8260 semsg(_(e_variable_already_declared), arg); 8262 semsg(_(e_variable_already_declared), arg);
8261 goto failed; 8263 goto failed;
8262 } 8264 }