Merge: doc: fixed some typos and other misc. corrections
[nit.git] / src / metrics / self_metrics.nit
index 58aa69d..ba7ea78 100644 (file)
 # Metrics about the usage of explicit and implicit self
 module self_metrics
 
-import modelbuilder
-private import metrics_base
+import metrics_base
+
+redef class ToolContext
+       var self_metrics_phase: Phase = new SelfMetricsPhase(self, null)
+end
+
+private class SelfMetricsPhase
+       super Phase
+       redef fun process_mainmodule(mainmodule, given_mmodules)
+       do
+               if not toolcontext.opt_self.value and not toolcontext.opt_all.value then return
+               compute_self_metrics(toolcontext.modelbuilder)
+       end
+end
 
 private class ASelfVisitor
        super Visitor