From 65adae941227db5b9c2b1980114df202230d4953 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 19 Sep 2014 14:54:59 -0400 Subject: [PATCH] toolcontext: add `error_info` for displaying total errors&warnings Signed-off-by: Jean Privat --- src/phase.nit | 2 ++ src/toolcontext.nit | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/phase.nit b/src/phase.nit index b3d32dc..d1cc1cb 100644 --- a/src/phase.nit +++ b/src/phase.nit @@ -132,6 +132,8 @@ redef class ToolContext var time1 = get_time self.info("*** END SEMANTIC ANALYSIS: {time1-time0} ***", 2) + + errors_info end fun phase_process_npropdef(phase: Phase, npropdef: APropdef) diff --git a/src/toolcontext.nit b/src/toolcontext.nit index 16b4deb..95b6e9b 100644 --- a/src/toolcontext.nit +++ b/src/toolcontext.nit @@ -120,7 +120,18 @@ class ToolContext messages.clear end - if error_count > 0 then exit(1) + if error_count > 0 then + errors_info + exit(1) + end + end + + # Display total error informations + fun errors_info + do + if error_count == 0 and warning_count == 0 then return + if opt_no_color.value then return + sys.stderr.write "Errors: {error_count}. Warnings: {warning_count}.\n" end # Display an error -- 1.7.9.5