src/model: collect package modules
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 31 Aug 2016 14:26:29 +0000 (10:26 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 28 Nov 2016 22:12:13 +0000 (17:12 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/model/model_collect.nit

index d4e40f4..bfe5fdf 100644 (file)
@@ -154,6 +154,18 @@ redef class MPackage
                end
                return res
        end
+
+       # `MModules` contained in `self`.
+       fun collect_mmodules(view: ModelView): HashSet[MModule] do
+               var res = new HashSet[MModule]
+               for mgroup in mgroups do
+                       for mmodule in mgroup.mmodules do
+                               if not view.accept_mentity(mmodule) then continue
+                               res.add(mmodule)
+                       end
+               end
+               return res
+       end
 end
 
 redef class MGroup