rename 'package' to 'module'
[nit.git] / src / compiling / table_computation.nit
index 20461ff..73e62cd 100644 (file)
 # 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.
@@ -112,6 +112,9 @@ redef class MMConcreteClass
                                        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
@@ -162,6 +165,7 @@ redef class Program
 
                ctab.add(new TableEltClassSelfId)
                ctab.add(new TableEltClassObjectSize)
+               ctab.add(new TableEltClassSelfName)
                itab.add(new TableEltVftPointer)
                itab.add(new TableEltObjectId)
 
@@ -407,12 +411,12 @@ end
 ###############################################################################
 
 # 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
@@ -426,7 +430,7 @@ end
 
 # An element of a module table
 # Such an elements represent colors or identifiers
-abstract class ModuleTableElt
+interface ModuleTableElt
        super AbsTableElt
 end
 
@@ -452,6 +456,16 @@ class TableEltMeth
        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
@@ -463,7 +477,7 @@ class TableEltAttr
 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
@@ -475,7 +489,7 @@ class AbsTableEltClass
 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)
@@ -536,6 +550,12 @@ class TableEltClassSelfId
        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