aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-03-22 10:09:28 +0000
committerGitHub <noreply@github.com>2023-03-22 10:09:28 +0000
commit3285cd6eccd9b7f33cc32f992c2607c3fc4ca13f (patch)
tree4357dab570945b69f7ee3c4406c45c1153222049 /src/nvim/lua/executor.c
parentc45b5e2c5b0f02742099ebccc44462fe4203e99c (diff)
downloadrneovim-3285cd6eccd9b7f33cc32f992c2607c3fc4ca13f.tar.gz
rneovim-3285cd6eccd9b7f33cc32f992c2607c3fc4ca13f.tar.bz2
rneovim-3285cd6eccd9b7f33cc32f992c2607c3fc4ca13f.zip
refactor: do more in TRY_WRAP
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 7e331a097f..dfbbfe9ab5 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1157,28 +1157,29 @@ int nlua_call(lua_State *lstate)
}
}
- TRY_WRAP({
- // TODO(bfredl): this should be simplified in error handling refactor
- force_abort = false;
- suppress_errthrow = false;
- did_throw = false;
- did_emsg = false;
-
- try_start();
- typval_T rettv;
- funcexe_T funcexe = FUNCEXE_INIT;
- funcexe.fe_firstline = curwin->w_cursor.lnum;
- funcexe.fe_lastline = curwin->w_cursor.lnum;
- funcexe.fe_evaluate = true;
+ // TODO(bfredl): this should be simplified in error handling refactor
+ force_abort = false;
+ suppress_errthrow = false;
+ did_throw = false;
+ did_emsg = false;
+
+ typval_T rettv;
+ funcexe_T funcexe = FUNCEXE_INIT;
+ funcexe.fe_firstline = curwin->w_cursor.lnum;
+ funcexe.fe_lastline = curwin->w_cursor.lnum;
+ funcexe.fe_evaluate = true;
+
+ TRY_WRAP(&err, {
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
// (TRY_WRAP) to capture abort-causing non-exception errors.
(void)call_func((char *)name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
- if (!try_end(&err)) {
- nlua_push_typval(lstate, &rettv, false);
- }
- tv_clear(&rettv);
});
+ if (!ERROR_SET(&err)) {
+ nlua_push_typval(lstate, &rettv, false);
+ }
+ tv_clear(&rettv);
+
free_vim_args:
while (i > 0) {
tv_clear(&vim_args[--i]);