# Can self be used as a root init?
private fun look_like_a_root_init(modelbuilder: ModelBuilder, mclassdef: MClassDef): Bool
do
# Need the `init` keyword
if n_kwinit == null then return false
# Need to by anonymous
if self.n_methid != null then return false
# No annotation on itself
if get_single_annotation("old_style_init", modelbuilder) != null then return false
# Nor on its module
var amod = self.parent.parent.as(AModule)
var amoddecl = amod.n_moduledecl
if amoddecl != null then
var old = amoddecl.get_single_annotation("old_style_init", modelbuilder)
if old != null then return false
end
# No parameters
if self.n_signature.n_params.length > 0 then
modelbuilder.advice(self, "old-init", "Warning: init with signature in {mclassdef}")
return false
end
# Cannot be private or something
if not self.n_visibility isa APublicVisibility then
modelbuilder.advice(self, "old-init", "Warning: non-public init in {mclassdef}")
return false
end
return true
end
src/modelize/modelize_property.nit:764,2--792,4