model_utils: extract mclass mproperties
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 5 Jun 2014 20:59:14 +0000 (16:59 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 5 Jun 2014 20:59:48 +0000 (16:59 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/model_utils.nit

index 84d5d1d..b2c741b 100644 (file)
@@ -200,6 +200,18 @@ redef class MClass
                return set
        end
 
+       fun intro_mpropdefs(min_visibility: MVisibility): Set[MPropDef] do
+               var set = new HashSet[MPropDef]
+               for mclassdef in mclassdefs do
+                       for mpropdef in mclassdef.mpropdefs do
+                               if not mpropdef.is_intro then continue
+                               if mpropdef.mproperty.visibility < min_visibility then continue
+                               set.add(mpropdef)
+                       end
+               end
+               return set
+       end
+
        # the set of locally refined properties in 'self'.
        fun redef_mproperties(min_visibility: MVisibility): Set[MProperty] do
                var set = new HashSet[MProperty]
@@ -212,6 +224,18 @@ redef class MClass
                return set
        end
 
+       fun redef_mpropdefs(min_visibility: MVisibility): Set[MPropDef] do
+               var set = new HashSet[MPropDef]
+               for mclassdef in mclassdefs do
+                       for mpropdef in mclassdef.mpropdefs do
+                               if mpropdef.is_intro then continue
+                               if mpropdef.mproperty.visibility < min_visibility then continue
+                               set.add(mpropdef)
+                       end
+               end
+               return set
+       end
+
        # the set of methods inherited by 'self'.
        fun inherited_mproperties(mainmodule: MModule, min_visibility: MVisibility): Set[MProperty] do
                var set = new HashSet[MProperty]