0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2021-03-25 22:15:28 +01:00
parent a91a71322d
commit fa984418e7
8 changed files with 131 additions and 25 deletions

View File

@@ -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