src: Update init
[nit.git] / src / metrics / ast_metrics.nit
index d66115e..e5f1e10 100644 (file)
 
 # Metrics about the nodes and identifiers in the AST
 module ast_metrics
-import modelbuilder
-private import metrics_base
-import frontend
+import metrics_base
 
 redef class ToolContext
-       var ast_metrics_phase = new AstMetricsPhase(self, null)
+       var ast_metrics_phase: Phase = new AstMetricsPhase(self, null)
 end
 
 private class AstMetricsPhase
@@ -29,7 +27,7 @@ private class AstMetricsPhase
        var node_counter = new Counter[String]
        var id_counter = new Counter[String]
 
-       redef fun process_mainmodule(mainmodule)
+       redef fun process_mainmodule(mainmodule, given_mmodules)
        do
                if not toolcontext.opt_ast.value and not toolcontext.opt_all.value then return
                print "--- AST Metrics ---"
@@ -51,11 +49,9 @@ private class AstMetricsVisitor
        super Visitor
 
        var phase: AstMetricsPhase
-       init(phase: AstMetricsPhase) do self.phase = phase
 
        redef fun visit(n)
        do
-               if n == null then return
                n.visit_all(self)
                phase.node_counter.inc(n.class_name)
                if n isa TId or n isa TAttrid or n isa TClassid then