Merge: engines: no more `super_inits` method used in old-style automatic init
[nit.git] / src / model_utils.nit
index 3fba8dc..ff1a8d9 100644 (file)
@@ -17,7 +17,7 @@
 # Model exploration and traversing facilities
 module model_utils
 
-import modelbuilder
+import model
 
 redef class MConcern
 
@@ -25,7 +25,7 @@ redef class MConcern
        # see: `MConcernRankSorter`
        # Use a positive booster to push down a result in the list
        # A negative booster can be used to push up the result
-       var booster_rank: Int writable = 0
+       var booster_rank: Int = 0 is writable
 
        # Concern ranking used for ordering
        # see: `MConcernRankSorter`
@@ -34,7 +34,7 @@ redef class MConcern
 end
 
 redef class MProject
-       redef fun concern_rank do
+       redef fun concern_rank is cached do
                var max = 0
                for mgroup in mgroups do
                        var mmax = mgroup.concern_rank
@@ -87,7 +87,7 @@ redef class MGroup
                return res
        end
 
-       redef fun concern_rank do
+       redef fun concern_rank is cached do
                var max = 0
                for mmodule in collect_mmodules do
                        var mmax = mmodule.concern_rank
@@ -201,7 +201,7 @@ redef class MModule
                return res
        end
 
-       redef fun concern_rank do
+       redef fun concern_rank is cached do
                var max = 0
                for p in in_importation.direct_greaters do
                        var pmax = p.concern_rank
@@ -213,16 +213,6 @@ end
 
 redef class MClass
 
-       # Get the public owner of 'self'.
-       fun public_owner: MModule do
-               var public_owner = self.intro_mmodule.public_owner
-               if public_owner == null then
-                       return self.intro_mmodule
-               else
-                       return public_owner
-               end
-       end
-
        # Get direct parents of 'self'.
        fun parents: Set[MClass] do
                var ret = new HashSet[MClass]
@@ -427,8 +417,8 @@ redef class MClass
        # Get the list of all parameter types in 'self'.
        fun parameter_types: Map[String, MType] do
                var res = new HashMap[String, MType]
-               for i in [0..intro.parameter_names.length[ do
-                       res[intro.parameter_names[i]] = intro.bound_mtype.arguments[i]
+               for p in mparameters do
+                       res[p.name] = p
                end
                return res
        end