aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_eval.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 02:06:53 -0500
committerGitHub <noreply@github.com>2020-12-20 02:06:53 -0500
commit9539d46bb120ac135f390600ea6f82112478ef1d (patch)
treeabfa1cdc27e30e8a7163de34d1af0a3125072c8b /src/nvim/ex_eval.c
parent7e4c912565f1dc00a873cff14ca435af9796cd4c (diff)
parent7390cc8b2905a5831ad870a240496b8c355fa9b1 (diff)
downloadrneovim-9539d46bb120ac135f390600ea6f82112478ef1d.tar.gz
rneovim-9539d46bb120ac135f390600ea6f82112478ef1d.tar.bz2
rneovim-9539d46bb120ac135f390600ea6f82112478ef1d.zip
Merge pull request #13563 from janlazo/vim-8.2.2161
vim-patch:8.1.0470,8.2.{2161,2163}
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r--src/nvim/ex_eval.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 0c7562980a..0917c6dd02 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -518,10 +518,13 @@ fail:
* Discard an exception. "was_finished" is set when the exception has been
* caught and the catch clause has been ended normally.
*/
-static void discard_exception(except_T *excp, int was_finished)
+static void discard_exception(except_T *excp, bool was_finished)
{
char_u *saved_IObuff;
+ if (current_exception == excp) {
+ current_exception = NULL;
+ }
if (excp == NULL) {
internal_error("discard_exception()");
return;
@@ -569,7 +572,6 @@ void discard_current_exception(void)
{
if (current_exception != NULL) {
discard_exception(current_exception, false);
- current_exception = NULL;
}
// Note: all globals manipulated here should be saved/restored in
// try_enter/try_leave.
@@ -652,8 +654,8 @@ static void finish_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, NULL, -1);
}
- /* Discard the exception, but use the finish message for 'verbose'. */
- discard_exception(excp, TRUE);
+ // Discard the exception, but use the finish message for 'verbose'.
+ discard_exception(excp, true);
}
/*
@@ -1812,11 +1814,12 @@ void leave_cleanup(cleanup_T *csp)
* made pending by it. Report this to the user if required by the
* 'verbose' option or when debugging. */
if (aborting() || need_rethrow) {
- if (pending & CSTP_THROW)
- /* Cancel the pending exception (includes report). */
- discard_exception(csp->exception, FALSE);
- else
+ if (pending & CSTP_THROW) {
+ // Cancel the pending exception (includes report).
+ discard_exception(csp->exception, false);
+ } else {
report_discard_pending(pending, NULL);
+ }
/* If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */
@@ -1916,15 +1919,13 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
default:
if (cstack->cs_flags[idx] & CSF_FINALLY) {
if (cstack->cs_pending[idx] & CSTP_THROW) {
- /* Cancel the pending exception. This is in the
- * finally clause, so that the stack of the
- * caught exceptions is not involved. */
- discard_exception((except_T *)
- cstack->cs_exception[idx],
- FALSE);
- } else
- report_discard_pending(cstack->cs_pending[idx],
- NULL);
+ // Cancel the pending exception. This is in the
+ // finally clause, so that the stack of the
+ // caught exceptions is not involved.
+ discard_exception((except_T *)cstack->cs_exception[idx], false);
+ } else {
+ report_discard_pending(cstack->cs_pending[idx], NULL);
+ }
cstack->cs_pending[idx] = CSTP_NONE;
}
break;