toolcontext: add `error_info` for displaying total errors&warnings
authorJean Privat <jean@pryen.org>
Fri, 19 Sep 2014 18:54:59 +0000 (14:54 -0400)
committerJean Privat <jean@pryen.org>
Fri, 19 Sep 2014 20:00:02 +0000 (16:00 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/phase.nit
src/toolcontext.nit

index b3d32dc..d1cc1cb 100644 (file)
@@ -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)
index 16b4deb..95b6e9b 100644 (file)
@@ -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