Mercurial > vim
diff src/ex_eval.c @ 24222:a2e6029d354e v8.2.2652
patch 8.2.2652: Vim9: can use command modifier without an effect
Commit: https://github.com/vim/vim/commit/fa984418e7becd8e7d6543cd3ea25f605e9ac97f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 25 22:15:28 2021 +0100
patch 8.2.2652: Vim9: can use command modifier without an effect
Problem: Vim9: can use command modifier without an effect.
Solution: Give an error for a misplaced command modifier. Fix error message
number.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Mar 2021 22:30:04 +0100 |
parents | 29b15fbc2bcb |
children | 3058ed6db36f |
line wrap: on
line diff
--- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1011,6 +1011,8 @@ ex_endif(exarg_T *eap) { cstack_T *cstack = eap->cstack; + if (cmdmod_error()) + return; did_endif = TRUE; if (cstack->cs_idx < 0 || (cstack->cs_flags[cstack->cs_idx] @@ -1314,6 +1316,9 @@ ex_endwhile(exarg_T *eap) int csf; int fl; + if (cmdmod_error()) + return; + if (eap->cmdidx == CMD_endwhile) { err = e_while; @@ -1539,6 +1544,9 @@ ex_try(exarg_T *eap) int skip; cstack_T *cstack = eap->cstack; + if (cmdmod_error()) + return; + if (cstack->cs_idx == CSTACK_LEN - 1) eap->errmsg = _("E601: :try nesting too deep"); else @@ -1617,6 +1625,9 @@ ex_catch(exarg_T *eap) cstack_T *cstack = eap->cstack; char_u *pat; + if (cmdmod_error()) + return; + if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) { eap->errmsg = _(e_catch); @@ -1777,6 +1788,9 @@ ex_finally(exarg_T *eap) int pending = CSTP_NONE; cstack_T *cstack = eap->cstack; + if (cmdmod_error()) + return; + if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) eap->errmsg = _(e_finally); else @@ -1906,6 +1920,9 @@ ex_endtry(exarg_T *eap) void *rettv = NULL; cstack_T *cstack = eap->cstack; + if (cmdmod_error()) + return; + if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) eap->errmsg = _(e_no_endtry); else