tool: use ccache in gccx, if available
[nit.git] / src / metamodel / abstractmetamodel.nit
index 6eb24b9..cc321ac 100644 (file)
@@ -54,7 +54,6 @@ class MMContext
        fun add_local_class(c: MMLocalClass, sup: Array[MMLocalClass])
        do
                var csup = new Array[MMLocalClass]
-               var csups = new Array[String]
                for s in sup do
                        if s isa MMConcreteClass then
                                csup.add(s)
@@ -128,10 +127,10 @@ class MMModule
        readable var _mhe: nullable PartialOrderElement[MMModule]
 
        # All global classes of the module (defined and imported)
-       readable var _global_classes: Array[MMGlobalClass] = new Array[MMGlobalClass]
+       readable var _global_classes: Set[MMGlobalClass] = new HashSet[MMGlobalClass]
 
        # All local classes of the module (defined and imported)
-       readable var _local_classes: Array[MMLocalClass] = new Array[MMLocalClass]
+       readable var _local_classes: Set[MMLocalClass] = new HashSet[MMLocalClass]
 
        # Class specialization hierarchy of the module.
        readable var _class_specialization_hierarchy: PartialOrder[MMLocalClass] = new PartialOrder[MMLocalClass]
@@ -325,7 +324,7 @@ end
 # Local classes are classes defined, refined or imported in a module
 class MMLocalClass
        # The name of the local class
-        readable var _name: Symbol
+       readable var _name: Symbol
 
        # Arity of the local class (if generic)
        # FIXME: How to move this into the generic module in a sane way?
@@ -506,6 +505,28 @@ class MMLocalClass
        do
                return _name.to_s
        end
+
+       # Comparaison in a total order that superset the class refinement and the class specialisation relations
+       fun total_order_compare(b: MMLocalClass): Int
+       do
+               var a = self
+               if a == b then
+                       return 0
+               else if a.module.mhe < b.module then
+                       return 1
+               else if b.module.mhe < a.module then
+                       return -1
+               end
+               var ar = a.cshe.rank
+               var br = b.cshe.rank
+               if ar > br then
+                       return 1
+               else if br > ar then
+                       return -1
+               else
+                       return b.name.to_s <=> a.name.to_s
+               end
+       end
 end
 
 # A global property gather local properties that correspond to a same message
@@ -639,6 +660,9 @@ special MMLocalProperty
 
        # Is the method abstract
        fun is_abstract: Bool is abstract
+
+       # Is the method extern, if yes what is the extern_name
+       fun extern_name: nullable String is abstract
 end
 
 # Concrete local classes