nitc $ MethodAnalyzeMetrics :: SELF
Type of this instance, automatically specialized in every classnitc $ MethodAnalyzeMetrics :: visit
What the visitor do when a node is visitedcore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: Visitor :: current_node=
The current visited nodenitc :: Visitor :: defaultinit
core :: Object :: defaultinit
nitc :: Visitor :: enter_visit
Ask the visitor to visit a given node.core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
public class MethodAnalyzeMetrics
super Visitor
var ameth_prop_def: AMethPropdef
var line_number = new Counter[nullable Int]
var total_self_call = 0
var class_call = new Counter[MClassType]
redef fun visit(n) do
n.visit_all(self)
if n isa AExpr then
if not n isa ABlockExpr then
if n.first_location != null then
line_number.inc(n.first_location.line_start)
end
end
end
if n isa ASendExpr then
var callsite = n.callsite
if callsite != null then
var class_site_recv = callsite.recv
if class_site_recv isa MClassType then class_call.inc(class_site_recv)
if callsite.recv_is_self then self.total_self_call += 1
end
end
end
end
src/metrics/method_analyze_metrics.nit:48,1--73,3