diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-21 18:46:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-21 18:46:52 +0800 |
commit | 9971bea6f1380c15c22f5035d1d33d994f8a6ed7 (patch) | |
tree | 0cb4010ebf44f56941ecb16e6e0d5e4eee9df1da /src | |
parent | c049ce56cdbacd628f90e53755a0d7b0caac525a (diff) | |
download | rneovim-9971bea6f1380c15c22f5035d1d33d994f8a6ed7.tar.gz rneovim-9971bea6f1380c15c22f5035d1d33d994f8a6ed7.tar.bz2 rneovim-9971bea6f1380c15c22f5035d1d33d994f8a6ed7.zip |
vim-patch:9.0.2059: outstanding exceptions may be skipped (#25736)
Problem: outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
exceptions
closes: vim/vim#13386
https://github.com/vim/vim/commit/0ab500dede4edd8d5aee7ddc63444537be527871
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_eval.c | 15 | ||||
-rw-r--r-- | src/nvim/ex_eval_defs.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 7412757726..a47c9027a7 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -668,17 +668,21 @@ void exception_state_save(exception_state_T *estate) estate->estate_did_throw = did_throw; estate->estate_need_rethrow = need_rethrow; estate->estate_trylevel = trylevel; + estate->estate_did_emsg = did_emsg; } /// Restore the current exception state from "estate" void exception_state_restore(exception_state_T *estate) { - if (current_exception == NULL) { - current_exception = estate->estate_current_exception; + // Handle any outstanding exceptions before restoring the state + if (did_throw) { + handle_did_throw(); } - did_throw |= estate->estate_did_throw; - need_rethrow |= estate->estate_need_rethrow; - trylevel |= estate->estate_trylevel; + current_exception = estate->estate_current_exception; + did_throw = estate->estate_did_throw; + need_rethrow = estate->estate_need_rethrow; + trylevel = estate->estate_trylevel; + did_emsg = estate->estate_did_emsg; } /// Clear the current exception state @@ -688,6 +692,7 @@ void exception_state_clear(void) did_throw = false; need_rethrow = false; trylevel = 0; + did_emsg = 0; } // Flags specifying the message displayed by report_pending. diff --git a/src/nvim/ex_eval_defs.h b/src/nvim/ex_eval_defs.h index 442e4581cc..16b8d2f02b 100644 --- a/src/nvim/ex_eval_defs.h +++ b/src/nvim/ex_eval_defs.h @@ -126,6 +126,7 @@ struct exception_state_S { bool estate_did_throw; bool estate_need_rethrow; int estate_trylevel; + int estate_did_emsg; }; #endif // NVIM_EX_EVAL_DEFS_H |