Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
24221:70ef6b343eee | 24222:a2e6029d354e |
---|---|
1009 void | 1009 void |
1010 ex_endif(exarg_T *eap) | 1010 ex_endif(exarg_T *eap) |
1011 { | 1011 { |
1012 cstack_T *cstack = eap->cstack; | 1012 cstack_T *cstack = eap->cstack; |
1013 | 1013 |
1014 if (cmdmod_error()) | |
1015 return; | |
1014 did_endif = TRUE; | 1016 did_endif = TRUE; |
1015 if (cstack->cs_idx < 0 | 1017 if (cstack->cs_idx < 0 |
1016 || (cstack->cs_flags[cstack->cs_idx] | 1018 || (cstack->cs_flags[cstack->cs_idx] |
1017 & (CSF_WHILE | CSF_FOR | CSF_TRY | CSF_BLOCK))) | 1019 & (CSF_WHILE | CSF_FOR | CSF_TRY | CSF_BLOCK))) |
1018 eap->errmsg = _(e_endif_without_if); | 1020 eap->errmsg = _(e_endif_without_if); |
1311 cstack_T *cstack = eap->cstack; | 1313 cstack_T *cstack = eap->cstack; |
1312 int idx; | 1314 int idx; |
1313 char *err; | 1315 char *err; |
1314 int csf; | 1316 int csf; |
1315 int fl; | 1317 int fl; |
1318 | |
1319 if (cmdmod_error()) | |
1320 return; | |
1316 | 1321 |
1317 if (eap->cmdidx == CMD_endwhile) | 1322 if (eap->cmdidx == CMD_endwhile) |
1318 { | 1323 { |
1319 err = e_while; | 1324 err = e_while; |
1320 csf = CSF_WHILE; | 1325 csf = CSF_WHILE; |
1537 ex_try(exarg_T *eap) | 1542 ex_try(exarg_T *eap) |
1538 { | 1543 { |
1539 int skip; | 1544 int skip; |
1540 cstack_T *cstack = eap->cstack; | 1545 cstack_T *cstack = eap->cstack; |
1541 | 1546 |
1547 if (cmdmod_error()) | |
1548 return; | |
1549 | |
1542 if (cstack->cs_idx == CSTACK_LEN - 1) | 1550 if (cstack->cs_idx == CSTACK_LEN - 1) |
1543 eap->errmsg = _("E601: :try nesting too deep"); | 1551 eap->errmsg = _("E601: :try nesting too deep"); |
1544 else | 1552 else |
1545 { | 1553 { |
1546 enter_block(cstack); | 1554 enter_block(cstack); |
1614 char_u *save_cpo; | 1622 char_u *save_cpo; |
1615 regmatch_T regmatch; | 1623 regmatch_T regmatch; |
1616 int prev_got_int; | 1624 int prev_got_int; |
1617 cstack_T *cstack = eap->cstack; | 1625 cstack_T *cstack = eap->cstack; |
1618 char_u *pat; | 1626 char_u *pat; |
1627 | |
1628 if (cmdmod_error()) | |
1629 return; | |
1619 | 1630 |
1620 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) | 1631 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) |
1621 { | 1632 { |
1622 eap->errmsg = _(e_catch); | 1633 eap->errmsg = _(e_catch); |
1623 give_up = TRUE; | 1634 give_up = TRUE; |
1775 int idx; | 1786 int idx; |
1776 int skip = FALSE; | 1787 int skip = FALSE; |
1777 int pending = CSTP_NONE; | 1788 int pending = CSTP_NONE; |
1778 cstack_T *cstack = eap->cstack; | 1789 cstack_T *cstack = eap->cstack; |
1779 | 1790 |
1791 if (cmdmod_error()) | |
1792 return; | |
1793 | |
1780 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) | 1794 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) |
1781 eap->errmsg = _(e_finally); | 1795 eap->errmsg = _(e_finally); |
1782 else | 1796 else |
1783 { | 1797 { |
1784 if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) | 1798 if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) |
1904 int rethrow = FALSE; | 1918 int rethrow = FALSE; |
1905 int pending = CSTP_NONE; | 1919 int pending = CSTP_NONE; |
1906 void *rettv = NULL; | 1920 void *rettv = NULL; |
1907 cstack_T *cstack = eap->cstack; | 1921 cstack_T *cstack = eap->cstack; |
1908 | 1922 |
1923 if (cmdmod_error()) | |
1924 return; | |
1925 | |
1909 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) | 1926 if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) |
1910 eap->errmsg = _(e_no_endtry); | 1927 eap->errmsg = _(e_no_endtry); |
1911 else | 1928 else |
1912 { | 1929 { |
1913 /* | 1930 /* |