Mercurial > vim
comparison src/vim9execute.c @ 25082:5c7a09cf97a1 v8.2.3078
patch 8.2.3078: Vim9: profile test fails
Commit: https://github.com/vim/vim/commit/834193afd7195bc96026d2aed696d64f8075cd35
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 30 20:39:15 2021 +0200
patch 8.2.3078: Vim9: profile test fails
Problem: Vim9: profile test fails.
Solution: Make throw in :catch jump to :finally.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 30 Jun 2021 20:45:04 +0200 |
parents | 146c9720e563 |
children | b2a6a71a11e8 |
comparison
equal
deleted
inserted
replaced
25081:8266083db124 | 25082:5c7a09cf97a1 |
---|---|
1575 // An exception jumps to the first catch, finally, or returns from | 1575 // An exception jumps to the first catch, finally, or returns from |
1576 // the current function. | 1576 // the current function. |
1577 while (index > 0) | 1577 while (index > 0) |
1578 { | 1578 { |
1579 trycmd = ((trycmd_T *)trystack->ga_data) + index - 1; | 1579 trycmd = ((trycmd_T *)trystack->ga_data) + index - 1; |
1580 if (!trycmd->tcd_in_catch) | 1580 if (!trycmd->tcd_in_catch || trycmd->tcd_finally_idx != 0) |
1581 break; | 1581 break; |
1582 // In the catch and finally block of this try we have to go up | 1582 // In the catch and finally block of this try we have to go up |
1583 // one level. | 1583 // one level. |
1584 --index; | 1584 --index; |
1585 trycmd = NULL; | 1585 trycmd = NULL; |
1586 } | 1586 } |
1587 if (trycmd != NULL && trycmd->tcd_frame_idx == ectx->ec_frame_idx) | 1587 if (trycmd != NULL && trycmd->tcd_frame_idx == ectx->ec_frame_idx) |
1588 { | 1588 { |
1589 // jump to ":catch" or ":finally" | 1589 if (trycmd->tcd_in_catch) |
1590 { | |
1591 // exception inside ":catch", jump to ":finally" once | |
1592 ectx->ec_iidx = trycmd->tcd_finally_idx; | |
1593 trycmd->tcd_finally_idx = 0; | |
1594 } | |
1595 else | |
1596 // jump to first ":catch" | |
1597 ectx->ec_iidx = trycmd->tcd_catch_idx; | |
1590 trycmd->tcd_in_catch = TRUE; | 1598 trycmd->tcd_in_catch = TRUE; |
1591 ectx->ec_iidx = trycmd->tcd_catch_idx; | |
1592 did_throw = FALSE; // don't come back here until :endtry | 1599 did_throw = FALSE; // don't come back here until :endtry |
1593 trycmd->tcd_did_throw = TRUE; | 1600 trycmd->tcd_did_throw = TRUE; |
1594 } | 1601 } |
1595 else | 1602 else |
1596 { | 1603 { |