Visit the AST and print metics about the usage of self.

Property definitions

nitc :: self_metrics $ Sys :: compute_self_metrics
# Visit the AST and print metics about the usage of self.
fun compute_self_metrics(modelbuilder: ModelBuilder)
do
	print "--- Explicit vs. Implicit Self ---"
	# Visit all the source code to collect data
	var visitor = new ASelfVisitor
	for nmodule in modelbuilder.nmodules do
		for nclassdef in nmodule.n_classdefs do
			visitor.enter_visit(nclassdef)
		end
	end
	print "Total number of self: {visitor.total}"
	print "Total number of implicit self: {visitor.implicits} ({div(visitor.implicits*100,visitor.total)}%)"
end
src/metrics/self_metrics.nit:52,1--65,3