nitc :: AstMetricsPhase :: defaultinit
private class AstMetricsPhase
super Phase
var node_counter = new Counter[String]
var id_counter = new Counter[String]
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 ---"
# Visit all the source code to collect data
var visitor = new AstMetricsVisitor(self)
for nmodule in toolcontext.modelbuilder.nmodules do
visitor.enter_visit(nmodule)
end
print "## All nodes of the AST"
node_counter.print_summary
node_counter.print_elements(10)
print "## All identifiers of the AST"
id_counter.print_summary
id_counter.print_elements(10)
end
end
src/metrics/ast_metrics.nit:25,1--46,3