model: add mproject module
[nit.git] / src / model / mmodule.nit
index e3fda2d..a3ee105 100644 (file)
@@ -19,7 +19,7 @@ module mmodule
 
 import poset
 import location
-import model_base
+import mproject
 private import more_collections
 
 # The container class of a Nit object-oriented model.
@@ -52,8 +52,12 @@ redef class Model
        end
 end
 
+redef class MGroup
+       # The loaded modules of this group
+       var mmodules = new Array[MModule]
+end
+
 # A Nit module is usually associated with a Nit source file.
-# Modules can be nested (see `direct_owner`, `public_owner`, and `in_nesting`)
 class MModule
        # The model considered
        var model: Model
@@ -61,6 +65,9 @@ class MModule
        # The direct nesting module, return null if self is not nested (ie. is a top-level module)
        var direct_owner: nullable MModule
 
+       # The group of module in the project if any
+       var mgroup: nullable MGroup
+
        # The short name of the module
        var name: String
 
@@ -77,14 +84,14 @@ class MModule
        var in_importation: POSetElement[MModule]
 
        # The canonical name of the module
-       # Example: `"owner::name"`
+       # Example: `"project::name"`
        fun full_name: String
        do
-               var owner = self.public_owner
-               if owner == null then
+               var mgroup = self.mgroup
+               if mgroup == null or mgroup.mproject.name == self.name then
                        return self.name
                else
-                       return "{owner.full_name}::{self.name}"
+                       return "{mgroup.mproject.name}::{self.name}"
                end
        end