# limitations under the License.
# Compute tables for classes and modules.
-package table_computation
+module table_computation
import mmloader
-import primitive_info
+private import primitive_info
import program
# Something that store color of table elements
-class ColorContext
+abstract class ColorContext
var _colors: HashMap[TableElt, Int] = new HashMap[TableElt, Int]
# The color of a table element.
ilt.add(new TableEltAttr(p))
else if p isa MMMethod then
clt.add(new TableEltMeth(p))
+ else if p isa MMTypeProperty then
+ clt.add(new TableEltVTClassId(p))
+ clt.add(new TableEltVTClassColor(p))
end
end
if p isa MMMethod and p.need_super then
ctab.add(new TableEltClassSelfId)
ctab.add(new TableEltClassObjectSize)
+ ctab.add(new TableEltClassSelfName)
itab.add(new TableEltVftPointer)
itab.add(new TableEltObjectId)
###############################################################################
# An element of a class, an instance or a module table
-abstract class AbsTableElt
+interface AbsTableElt
end
# An element of a class or an instance table
# Such an elements represent method function pointers, attribute values, etc.
-abstract class TableElt
+interface TableElt
super AbsTableElt
# Is the element conflict to class `c' (used for coloring)
fun is_related_to(c: MMLocalClass): Bool is abstract
# An element of a module table
# Such an elements represent colors or identifiers
-abstract class ModuleTableElt
+interface ModuleTableElt
super AbsTableElt
end
super TableEltProp
end
+# An element that represents a class color value for a virtual type
+class TableEltVTClassColor
+ super TableEltProp
+end
+
+# An element that represents a class id value for a virtual type
+class TableEltVTClassId
+ super TableEltProp
+end
+
# An element that represents a function pointer to the super method of a local method
class TableEltSuper
super TableEltProp
end
# An element representing a class information
-class AbsTableEltClass
+abstract class AbsTableEltClass
super AbsTableElt
# The local class where the information comes from
readable var _local_class: MMLocalClass
end
# An element of a class table representing a class information
-class TableEltClass
+abstract class TableEltClass
super TableElt
super AbsTableEltClass
redef fun is_related_to(c)
redef fun is_related_to(c) do return true
end
+# The element that represent the class name
+class TableEltClassSelfName
+ super TableElt
+ redef fun is_related_to(c) do return true
+end
+
# The element that represent the Object Size
class TableEltClassObjectSize
super TableElt