nitc :: NullableSends :: defaultinit
private class NullableSends
super Visitor
var nclassdef: AClassdef
var total_sends: Int = 0
var nullable_sends: Int = 0
var nullable_eq_sends: Int = 0
var buggy_sends: Int = 0
redef fun visit(n)
do
n.visit_all(self)
if n isa ASendExpr then
self.total_sends += 1
var t = n.n_expr.mtype
if t == null then
self.buggy_sends += 1
return
end
t = t.anchor_to(self.nclassdef.mclassdef.mmodule, self.nclassdef.mclassdef.bound_mtype)
if t isa MNullableType then
var p = n.callsite.mproperty
if p.is_null_safe then
self.nullable_eq_sends += 1
else
self.nullable_sends += 1
end
else if t isa MClassType then
# Nothing
else
n.debug("Problem: strange receiver type found: {t} ({t.class_name})")
end
end
end
end
src/metrics/nullables_metrics.nit:109,1--143,3