Mercurial > vim
diff src/vim9compile.c @ 22699:e82579016863 v8.2.1898
patch 8.2.1898: command modifier parsing always uses global cmdmod
Commit: https://github.com/vim/vim/commit/e10044015841711b989f9a898d427bcc1fdb4c32
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 24 20:49:43 2020 +0200
patch 8.2.1898: command modifier parsing always uses global cmdmod
Problem: Command modifier parsing always uses global cmdmod.
Solution: Pass in cmdmod_T to use. Rename struct fields consistently.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Oct 2020 21:00:05 +0200 |
parents | c996700d569f |
children | f2bfee4ac356 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1826,17 +1826,17 @@ generate_EXECCONCAT(cctx_T *cctx, int co * Generate any instructions for side effects of "cmdmod". */ static int -generate_cmdmods(cctx_T *cctx) +generate_cmdmods(cctx_T *cctx, cmdmod_T *cmod) { isn_T *isn; // TODO: use more modifiers in the command - if (cmdmod.cmod_flags & (CMOD_SILENT | CMOD_ERRSILENT)) + if (cmod->cmod_flags & (CMOD_SILENT | CMOD_ERRSILENT)) { if ((isn = generate_instr(cctx, ISN_SILENT)) == NULL) return FAIL; - isn->isn_arg.number = (cmdmod.cmod_flags & CMOD_ERRSILENT) != 0; - cctx->ctx_silent = (cmdmod.cmod_flags & CMOD_ERRSILENT) ? 2 : 1; + isn->isn_arg.number = (cmod->cmod_flags & CMOD_ERRSILENT) != 0; + cctx->ctx_silent = (cmod->cmod_flags & CMOD_ERRSILENT) ? 2 : 1; } return OK; } @@ -7092,10 +7092,9 @@ compile_def_function(ufunc_T *ufunc, int for (;;) { exarg_T ea; - cmdmod_T save_cmdmod; + cmdmod_T local_cmdmod; int starts_with_colon = FALSE; char_u *cmd; - int save_msg_scroll = msg_scroll; // Bail out on the first error to avoid a flood of errors and report // the right line number when inside try/catch. @@ -7176,8 +7175,9 @@ compile_def_function(ufunc_T *ufunc, int /* * COMMAND MODIFIERS */ - save_cmdmod = cmdmod; - if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL) + CLEAR_FIELD(local_cmdmod); + if (parse_command_modifiers(&ea, &errormsg, &local_cmdmod, FALSE) + == FAIL) { if (errormsg != NULL) goto erret; @@ -7185,10 +7185,8 @@ compile_def_function(ufunc_T *ufunc, int line = (char_u *)""; continue; } - generate_cmdmods(&cctx); - - undo_cmdmod(save_msg_scroll); - cmdmod = save_cmdmod; + generate_cmdmods(&cctx, &local_cmdmod); + undo_cmdmod(&local_cmdmod); // Skip ":call" to get to the function name. p = ea.cmd;