comparison src/vim9compile.c @ 26660:2b17f87b7bd1 v8.2.3859

patch 8.2.3859: Vim9: some code lines not tested Commit: https://github.com/vim/vim/commit/a99fb23842f055c511bfe1b62de7bbd14d5a99c0 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 20 12:25:03 2021 +0000 patch 8.2.3859: Vim9: some code lines not tested Problem: Vim9: some code lines not tested. Solution: Add a few specific tests.
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Dec 2021 13:30:03 +0100
parents ed73553992bf
children 4b23672d1f0e
comparison
equal deleted inserted replaced
26659:c4b51a7d535e 26660:2b17f87b7bd1
8331 { 8331 {
8332 p = skipwhite(p + 1); 8332 p = skipwhite(p + 1);
8333 lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE); 8333 lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE);
8334 } 8334 }
8335 8335
8336 // Script var is not supported.
8337 if (get_var_dest(name, &dest, CMD_for, &opt_flags, 8336 if (get_var_dest(name, &dest, CMD_for, &opt_flags,
8338 &vimvaridx, &type, cctx) == FAIL) 8337 &vimvaridx, &type, cctx) == FAIL)
8339 goto failed; 8338 goto failed;
8340 if (dest != dest_local) 8339 if (dest != dest_local)
8341 { 8340 {
8349 if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) 8348 if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL)
8350 goto failed; 8349 goto failed;
8351 } 8350 }
8352 else 8351 else
8353 { 8352 {
8353 // Script var is not supported.
8354 if (STRNCMP(name, "s:", 2) == 0)
8355 {
8356 emsg(_(e_cannot_use_script_variable_in_for_loop));
8357 goto failed;
8358 }
8359
8354 if (!valid_varname(arg, (int)varlen, FALSE)) 8360 if (!valid_varname(arg, (int)varlen, FALSE))
8355 goto failed; 8361 goto failed;
8356 if (lookup_local(arg, varlen, NULL, cctx) == OK) 8362 if (lookup_local(arg, varlen, NULL, cctx) == OK)
8357 { 8363 {
8358 semsg(_(e_variable_already_declared), arg); 8364 semsg(_(e_variable_already_declared), arg);
8359 goto failed;
8360 }
8361
8362 if (STRNCMP(name, "s:", 2) == 0)
8363 {
8364 semsg(_(e_cannot_declare_script_variable_in_function), name);
8365 goto failed; 8365 goto failed;
8366 } 8366 }
8367 8367
8368 // Reserve a variable to store "var". 8368 // Reserve a variable to store "var".
8369 where.wt_index = var_list ? idx + 1 : 0; 8369 where.wt_index = var_list ? idx + 1 : 0;