Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1577,7 +1577,7 @@ exec_instructions(ectx_T *ectx) while (index > 0) { trycmd = ((trycmd_T *)trystack->ga_data) + index - 1; - if (!trycmd->tcd_in_catch) + if (!trycmd->tcd_in_catch || trycmd->tcd_finally_idx != 0) break; // In the catch and finally block of this try we have to go up // one level. @@ -1586,9 +1586,16 @@ exec_instructions(ectx_T *ectx) } if (trycmd != NULL && trycmd->tcd_frame_idx == ectx->ec_frame_idx) { - // jump to ":catch" or ":finally" + if (trycmd->tcd_in_catch) + { + // exception inside ":catch", jump to ":finally" once + ectx->ec_iidx = trycmd->tcd_finally_idx; + trycmd->tcd_finally_idx = 0; + } + else + // jump to first ":catch" + ectx->ec_iidx = trycmd->tcd_catch_idx; trycmd->tcd_in_catch = TRUE; - ectx->ec_iidx = trycmd->tcd_catch_idx; did_throw = FALSE; // don't come back here until :endtry trycmd->tcd_did_throw = TRUE; }