nitpackage: move package path services up to `model/mpackage.nit`
[nit.git] / src / model / model_collect.nit
index 61d03a0..6edd044 100644 (file)
@@ -235,7 +235,7 @@ redef class MPackage
        # Collect all modules contained in `self`
        fun collect_all_mmodules(view: ModelView): HashSet[MModule] do
                var res = new HashSet[MModule]
-               for mgroup in collect_mgroups(view) do
+               for mgroup in collect_all_mgroups(view) do
                        res.add_all mgroup.collect_mmodules(view)
                end
                return res
@@ -568,6 +568,7 @@ redef class MClass
        # This method uses a flattened hierarchy containing all the mclassdefs.
        redef fun collect_parents(view) do
                var res = new HashSet[MENTITY]
+               if not view.mainmodule.flatten_mclass_hierarchy.has(self) then return res
                for mclass in in_hierarchy(view.mainmodule).direct_greaters do
                        if mclass == self or not view.accept_mentity(mclass) then continue
                        res.add mclass
@@ -580,6 +581,7 @@ redef class MClass
        # This method uses a flattened hierarchy containing all the mclassdefs.
        redef fun collect_children(view) do
                var res = new HashSet[MENTITY]
+               if not view.mainmodule.flatten_mclass_hierarchy.has(self) then return res
                for mclass in in_hierarchy(view.mainmodule).direct_smallers do
                        if mclass == self or not view.accept_mentity(mclass) then continue
                        res.add mclass