From: Florian Deljarry Date: Sat, 17 Aug 2019 17:40:54 +0000 (-0400) Subject: mmodule: Added support of package importation X-Git-Url: http://nitlanguage.org mmodule: Added support of package importation Now when the imported `mmodules` is added to the `mmodule_importation_hierarchy`, the `mmodules` package it's also added to `mpackage_importation_hierarchy`. Signed-off-by: Florian Deljarry --- diff --git a/src/model/mmodule.nit b/src/model/mmodule.nit index a410236..ab71dce 100644 --- a/src/model/mmodule.nit +++ b/src/model/mmodule.nit @@ -185,12 +185,19 @@ class MModule self.in_importation = model.mmodule_importation_hierarchy.add_node(self) end - # Register the imported modules (ie "import some_module") + # Register the imported modules (ie "import some_module") and packages importation graph + # In the same time it register the imported package # The visibility must be set with `set_visibility_for`. fun set_imported_mmodules(imported_mmodules: Array[MModule]) do for m in imported_mmodules do self.model.mmodule_importation_hierarchy.add_edge(self, m) + var actual_mpackage = self.mpackage + var imported_mpackage = m.mpackage + if actual_mpackage != null and imported_mpackage != null then + # Register the imported package + self.model.mpackage_importation_graph.add_arc(actual_mpackage, imported_mpackage) + end end end