aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_eval.c')
-rw-r--r--src/nvim/ex_eval.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 81274fcf2a..0c7562980a 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -87,17 +87,16 @@
*/
static int cause_abort = FALSE;
-/*
- * Return TRUE when immediately aborting on error, or when an interrupt
- * occurred or an exception was thrown but not caught. Use for ":{range}call"
- * to check whether an aborted function that does not handle a range itself
- * should be called again for the next line in the range. Also used for
- * cancelling expression evaluation after a function call caused an immediate
- * abort. Note that the first emsg() call temporarily resets "force_abort"
- * until the throw point for error messages has been reached. That is, during
- * cancellation of an expression evaluation after an aborting function call or
- * due to a parsing error, aborting() always returns the same value.
- */
+// Return true when immediately aborting on error, or when an interrupt
+// occurred or an exception was thrown but not caught. Use for ":{range}call"
+// to check whether an aborted function that does not handle a range itself
+// should be called again for the next line in the range. Also used for
+// cancelling expression evaluation after a function call caused an immediate
+// abort. Note that the first emsg() call temporarily resets "force_abort"
+// until the throw point for error messages has been reached. That is, during
+// cancellation of an expression evaluation after an aborting function call or
+// due to a parsing error, aborting() always returns the same value.
+// "got_int" is also set by calling interrupt().
int aborting(void)
{
return (did_emsg && force_abort) || got_int || current_exception;
@@ -139,16 +138,15 @@ int aborted_in_try(void)
return force_abort;
}
-/*
- * cause_errthrow(): Cause a throw of an error exception if appropriate.
- * Return TRUE if the error message should not be displayed by emsg().
- * Sets "ignore", if the emsg() call should be ignored completely.
- *
- * When several messages appear in the same command, the first is usually the
- * most specific one and used as the exception value. The "severe" flag can be
- * set to TRUE, if a later but severer message should be used instead.
- */
-int cause_errthrow(char_u *mesg, int severe, int *ignore)
+// cause_errthrow(): Cause a throw of an error exception if appropriate.
+// Return true if the error message should not be displayed by emsg().
+// Sets "ignore", if the emsg() call should be ignored completely.
+//
+// When several messages appear in the same command, the first is usually the
+// most specific one and used as the exception value. The "severe" flag can be
+// set to true, if a later but severer message should be used instead.
+bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore)
+ FUNC_ATTR_NONNULL_ALL
{
struct msglist *elem;
struct msglist **plist;
@@ -159,8 +157,9 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
* level. Also when no exception can be thrown. The message will be
* displayed by emsg().
*/
- if (suppress_errthrow)
- return FALSE;
+ if (suppress_errthrow) {
+ return false;
+ }
/*
* If emsg() has not been called previously, temporarily reset
@@ -196,8 +195,8 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
* not replaced by an interrupt message error exception.
*/
if (mesg == (char_u *)_(e_interr)) {
- *ignore = TRUE;
- return TRUE;
+ *ignore = true;
+ return true;
}
/*
@@ -232,8 +231,8 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
* catch clause; just finally clauses are executed before the script
* is terminated.
*/
- return FALSE;
- } else
+ return false;
+ } else // NOLINT(readability/braces)
#endif
{
/*
@@ -272,7 +271,7 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
(*msg_list)->throw_msg = tmsg;
}
}
- return TRUE;
+ return true;
}
}