model_collect: collect importation poset for modules
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 20 Apr 2016 23:46:18 +0000 (19:46 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 21 Apr 2016 21:37:14 +0000 (17:37 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/model/model_collect.nit

index 65107d9..c8d3766 100644 (file)
@@ -77,6 +77,17 @@ redef class MModule
                return res
        end
 
+       # Build the importation poset for `self`
+       fun importation_poset(view: ModelView): POSet[MModule] do
+               var mmodules = new HashSet[MModule]
+               mmodules.add self
+               mmodules.add_all collect_ancestors(view)
+               mmodules.add_all collect_parents(view)
+               mmodules.add_all collect_children(view)
+               mmodules.add_all collect_descendants(view)
+               return view.mmodules_poset(mmodules)
+       end
+
        # Collect mclassdefs introduced in `self` with `visibility >= to min_visibility`.
        fun collect_intro_mclassdefs(view: ModelView): Set[MClassDef] do
                var res = new HashSet[MClassDef]