X-Git-Url: http://nitlanguage.org diff --git a/src/model/mproject.nit b/src/model/mproject.nit index 49ce780..283d54c 100644 --- a/src/model/mproject.nit +++ b/src/model/mproject.nit @@ -18,6 +18,7 @@ module mproject import model_base private import more_collections import poset +import mdoc # A Nit project, that encompass a product class MProject @@ -26,6 +27,10 @@ class MProject # The name of the project redef var name: String + redef fun full_name do return name + + redef var c_name = name.to_cmangle is lazy + # The model of the project redef var model: Model @@ -37,16 +42,20 @@ class MProject redef fun to_s do return name - init(name: String, model: Model) + init do - self.name = name - self.model = model model.mprojects.add(self) model.mproject_by_name.add_one(name, self) end # MProject are always roots of the concerns hierarchy redef fun parent_concern do return null + + redef fun mdoc_or_fallback + do + if mdoc != null then return mdoc + return root.mdoc_or_fallback + end end # A group of modules in a project @@ -64,8 +73,9 @@ class MGroup # see `in_nesting` for more var parent: nullable MGroup - # fully qualified name - fun full_name: String + # Fully qualified name. + # It includes each parent group separated by `/` + redef fun full_name do var p = parent if p == null then return name @@ -75,21 +85,19 @@ class MGroup # The group is the group tree on the project (`mproject.mgroups`) # nested groups (children) are smaller # nesting group (see `parent`) is bigger - var in_nesting: POSetElement[MGroup] + var in_nesting: POSetElement[MGroup] is noinit # Is `self` the root of its project? fun is_root: Bool do return mproject.root == self # The filepath (usually a directory) of the group, if any - var filepath: nullable String is writable + var filepath: nullable String = null is writable - init (name: String, mproject: MProject, parent: nullable MGroup) + init do - self.name = name - self.mproject = mproject - self.parent = parent var tree = mproject.mgroups self.in_nesting = tree.add_node(self) + var parent = self.parent if parent != null then tree.add_edge(self, parent) end