From: Jean Privat Date: Fri, 19 Sep 2014 18:54:59 +0000 (-0400) Subject: toolcontext: add `error_info` for displaying total errors&warnings X-Git-Tag: v0.6.9~27^2~8 X-Git-Url: http://nitlanguage.org?hp=cb6171e346d6ccb88ff45fe386f44b1829d6dd74 toolcontext: add `error_info` for displaying total errors&warnings Signed-off-by: Jean Privat --- 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