nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src: update most tools to new constructors
[nit.git]
/
src
/
model
/
mproject.nit
diff --git
a/src/model/mproject.nit
b/src/model/mproject.nit
index
7bd502e
..
c23e5cb
100644
(file)
--- a/
src/model/mproject.nit
+++ b/
src/model/mproject.nit
@@
-19,7
+19,7
@@
import model_base
private import more_collections
import poset
private import more_collections
import poset
-# A Nit project, thas encompass a product
+# A Nit project, that encompass a product
class MProject
super MConcern
class MProject
super MConcern
@@
-27,20
+27,18
@@
class MProject
redef var name: String
# The model of the project
redef var name: String
# The model of the project
- var model: Model
+ redef var model: Model
# The root of the group tree
# The root of the group tree
- var root: nullable MGroup writable = null
+ var root: nullable MGroup = null is writable
# The group tree, as a POSet
var mgroups = new POSet[MGroup]
redef fun to_s do return name
# The group tree, as a POSet
var mgroups = new POSet[MGroup]
redef fun to_s do return name
- init(name: String, model: Model)
+ init
do
do
- self.name = name
- self.model = model
model.mprojects.add(self)
model.mproject_by_name.add_one(name, self)
end
model.mprojects.add(self)
model.mproject_by_name.add_one(name, self)
end
@@
-57,7
+55,7
@@
class MGroup
# empty name for a default group in a single-module project
redef var name: String
# empty name for a default group in a single-module project
redef var name: String
- # The englobing project
+ # The enclosing project
var mproject: MProject
# The parent group if any
var mproject: MProject
# The parent group if any
@@
-73,28
+71,28
@@
class MGroup
end
# The group is the group tree on the project (`mproject.mgroups`)
end
# The group is the group tree on the project (`mproject.mgroups`)
- # nested groups (children) are smallers
+ # nested groups (children) are smaller
# nesting group (see `parent`) is bigger
# 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
# Is `self` the root of its project?
fun is_root: Bool do return mproject.root == self
- # The filepath (usualy a directory) of the group, if any
- var filepath: nullable String writable
+ # The filepath (usually a directory) of the group, if any
+ var filepath: nullable String = null is writable
- init (name: String, mproject: MProject, parent: nullable MGroup)
+ init
do
do
- self.name = name
- self.mproject = mproject
- self.parent = parent
var tree = mproject.mgroups
self.in_nesting = tree.add_node(self)
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
end
if parent != null then
tree.add_edge(self, parent)
end
end
+ redef fun model do return mproject.model
+
redef fun parent_concern do
if not is_root then return parent
return mproject
redef fun parent_concern do
if not is_root then return parent
return mproject
@@
-108,7
+106,7
@@
redef class Model
var mprojects = new Array[MProject]
# Collections of project grouped by their names
var mprojects = new Array[MProject]
# Collections of project grouped by their names
- private var mproject_by_name: MultiHashMap[String, MProject] = new MultiHashMap[String, MProject]
+ private var mproject_by_name = new MultiHashMap[String, MProject]
# Return all project named `name`
# If such a project is not yet loaded, null is returned (instead of an empty array)
# Return all project named `name`
# If such a project is not yet loaded, null is returned (instead of an empty array)