comparison src/vim9compile.c @ 21689:10866fd07595 v8.2.1394

patch 8.2.1394: Vim9: compiling a function interferes with command modifiers Commit: https://github.com/vim/vim/commit/2dd0a2c39a3b3fbffc94d0676e472c78d02ebdbd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 8 15:10:27 2020 +0200 patch 8.2.1394: Vim9: compiling a function interferes with command modifiers Problem: Vim9: compiling a function interferes with command modifiers. Solution: Save and restore command modifiers. (closes https://github.com/vim/vim/issues/6658)
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Aug 2020 15:15:04 +0200
parents bb4f55d20951
children f41c646cb8b9
comparison
equal deleted inserted replaced
21688:c94bf5ee110e 21689:10866fd07595
2666 } 2666 }
2667 line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; 2667 line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum];
2668 cctx->ctx_line_start = line; 2668 cctx->ctx_line_start = line;
2669 SOURCING_LNUM = cctx->ctx_lnum + 1; 2669 SOURCING_LNUM = cctx->ctx_lnum + 1;
2670 } while (line == NULL || *skipwhite(line) == NUL 2670 } while (line == NULL || *skipwhite(line) == NUL
2671 || (skip_comment && vim9_comment_start(skipwhite(line)))); 2671 || (skip_comment && vim9_comment_start(skipwhite(line))));
2672 return line; 2672 return line;
2673 } 2673 }
2674 2674
2675 /* 2675 /*
2676 * If "*arg" is at the end of the line, advance to the next line. 2676 * If "*arg" is at the end of the line, advance to the next line.
7192 /* 7192 /*
7193 * Loop over all the lines of the function and generate instructions. 7193 * Loop over all the lines of the function and generate instructions.
7194 */ 7194 */
7195 for (;;) 7195 for (;;)
7196 { 7196 {
7197 exarg_T ea; 7197 exarg_T ea;
7198 int starts_with_colon = FALSE; 7198 cmdmod_T save_cmdmod;
7199 char_u *cmd; 7199 int starts_with_colon = FALSE;
7200 int save_msg_scroll = msg_scroll; 7200 char_u *cmd;
7201 int save_msg_scroll = msg_scroll;
7201 7202
7202 // Bail out on the first error to avoid a flood of errors and report 7203 // Bail out on the first error to avoid a flood of errors and report
7203 // the right line number when inside try/catch. 7204 // the right line number when inside try/catch.
7204 if (emsg_before != called_emsg) 7205 if (emsg_before != called_emsg)
7205 goto erret; 7206 goto erret;
7276 } 7277 }
7277 7278
7278 /* 7279 /*
7279 * COMMAND MODIFIERS 7280 * COMMAND MODIFIERS
7280 */ 7281 */
7282 save_cmdmod = cmdmod;
7281 if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL) 7283 if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL)
7282 { 7284 {
7283 if (errormsg != NULL) 7285 if (errormsg != NULL)
7284 goto erret; 7286 goto erret;
7285 // empty line or comment 7287 // empty line or comment
7286 line = (char_u *)""; 7288 line = (char_u *)"";
7287 continue; 7289 continue;
7288 } 7290 }
7289 // TODO: use modifiers in the command 7291 // TODO: use modifiers in the command
7290 undo_cmdmod(&ea, save_msg_scroll); 7292 undo_cmdmod(&ea, save_msg_scroll);
7291 CLEAR_FIELD(cmdmod); 7293 cmdmod = save_cmdmod;
7292 7294
7293 // Skip ":call" to get to the function name. 7295 // Skip ":call" to get to the function name.
7294 if (checkforcmd(&ea.cmd, "call", 3)) 7296 if (checkforcmd(&ea.cmd, "call", 3))
7295 ea.cmd = skipwhite(ea.cmd); 7297 ea.cmd = skipwhite(ea.cmd);
7296 7298