nitc :: MClassDef :: add_in_hierarchy
This function can only invoked once by class
REQUIRE: self.in_hierarchy == null
ENSURE: self.in_hierarchy != null
# Collect the super-types (set by set_supertypes) to build the hierarchy
#
# This function can only invoked once by class
# REQUIRE: `self.in_hierarchy == null`
# ENSURE: `self.in_hierarchy != null`
fun add_in_hierarchy
do
assert unique_invocation: self.in_hierarchy == null
var model = mmodule.model
var res = model.mclassdef_hierarchy.add_node(self)
self.in_hierarchy = res
var mtype = self.bound_mtype
# Here we need to connect the mclassdef to its pairs in the mclassdef_hierarchy
# The simpliest way is to attach it to collect_mclassdefs
for mclassdef in mtype.collect_mclassdefs(mmodule) do
res.poset.add_edge(self, mclassdef)
end
end
src/model/model.nit:749,2--767,4