Mercurial > vim
comparison src/vim9execute.c @ 24002:5dbed4837ea3 v8.2.2543
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Commit: https://github.com/vim/vim/commit/9cb577a68277d46cc1134ef1723e90ff5f1d1b5c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 22 22:45:10 2021 +0100
patch 8.2.2543: Vim9: a return inside try/catch does not restore properly
Problem: Vim9: a return inside try/catch does not restore exception state
properly.
Solution: When there is no ":finally" jump to ":endtry". (closes #7882)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Feb 2021 23:00:04 +0100 |
parents | 3daeb2060f25 |
children | e45b2e28e45e |
comparison
equal
deleted
inserted
replaced
24001:b0191a86ab43 | 24002:5dbed4837ea3 |
---|---|
2515 | 2515 |
2516 if (trystack->ga_len > 0) | 2516 if (trystack->ga_len > 0) |
2517 trycmd = ((trycmd_T *)trystack->ga_data) | 2517 trycmd = ((trycmd_T *)trystack->ga_data) |
2518 + trystack->ga_len - 1; | 2518 + trystack->ga_len - 1; |
2519 if (trycmd != NULL | 2519 if (trycmd != NULL |
2520 && trycmd->tcd_frame_idx == ectx.ec_frame_idx | 2520 && trycmd->tcd_frame_idx == ectx.ec_frame_idx) |
2521 && trycmd->tcd_finally_idx != 0) | 2521 { |
2522 { | 2522 // jump to ":finally" or ":endtry" |
2523 // jump to ":finally" once | 2523 if (trycmd->tcd_finally_idx != 0) |
2524 ectx.ec_iidx = trycmd->tcd_finally_idx; | 2524 ectx.ec_iidx = trycmd->tcd_finally_idx; |
2525 else | |
2526 ectx.ec_iidx = trycmd->tcd_endtry_idx; | |
2525 trycmd->tcd_return = TRUE; | 2527 trycmd->tcd_return = TRUE; |
2526 } | 2528 } |
2527 else | 2529 else |
2528 goto func_return; | 2530 goto func_return; |
2529 } | 2531 } |