-# A method definitions customized to a specific receiver
-class CustomizedMethodDef
- var mmethoddef: MMethodDef
- var receiver: MClassType
+ private fun check_depth(mtype: MClassType)
+ do
+ var d = mtype.length
+ if d > 255 then
+ self.modelbuilder.toolcontext.fatal_error(null, "Fatal error: limitation in the rapidtype analysis engine: a type depth of {d} is too important, the problematic type is {mtype}.")
+ end
+ end
+
+ fun add_new(recv: MClassType, mtype: MClassType)
+ do
+ assert not recv.need_anchor
+ if mtype.need_anchor then
+ if live_open_types.has(mtype) then return
+ live_open_types.add(mtype)
+ else
+ if live_types.has(mtype) then return
+ live_types.add(mtype)
+ end
+
+ var mclass = mtype.mclass
+ if live_classes.has(mclass) then return
+ live_classes.add(mclass)
+
+ for p in totry_methods do try_send(mtype, p)
+ for p in live_super_sends do try_super_send(mtype, p)
+
+ # Remove cleared ones
+ for p in totry_methods_to_remove do totry_methods.remove(p)
+ totry_methods_to_remove.clear
+
+ var bound_mtype = mtype.anchor_to(mainmodule, recv)
+ for cd in bound_mtype.collect_mclassdefs(mainmodule)
+ do
+ for npropdef in modelbuilder.collect_attr_propdef(cd) do
+ if not npropdef.has_value then continue
+
+ var mpropdef = npropdef.mpropdef.as(not null)
+ var v = new RapidTypeVisitor(self, bound_mtype, mpropdef)
+ v.enter_visit(npropdef.n_expr)
+ v.enter_visit(npropdef.n_block)
+ end
+ end
+
+ end