nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
model: introduce filters
[nit.git]
/
src
/
model
/
mpackage.nit
diff --git
a/src/model/mpackage.nit
b/src/model/mpackage.nit
index
c1625ee
..
bb6856b
100644
(file)
--- a/
src/model/mpackage.nit
+++ b/
src/model/mpackage.nit
@@
-25,14
+25,16
@@
class MPackage
super MConcern
# The name of the package
super MConcern
# The name of the package
- redef var name: String
+ redef var name
redef fun full_name do return name
redef var c_name = name.to_cmangle is lazy
# The model of the package
redef fun full_name do return name
redef var c_name = name.to_cmangle is lazy
# The model of the package
- redef var model: Model
+ redef var model
+
+ redef var location
# The root of the group tree
var root: nullable MGroup = null is writable
# The root of the group tree
var root: nullable MGroup = null is writable
@@
-53,8
+55,11
@@
class MPackage
redef fun mdoc_or_fallback
do
redef fun mdoc_or_fallback
do
+ var mdoc = self.mdoc
if mdoc != null then return mdoc
if mdoc != null then return mdoc
- return root.mdoc_or_fallback
+ var root = self.root
+ if root != null then return root.mdoc_or_fallback
+ return null
end
end
end
end
@@
-64,7
+69,9
@@
class MGroup
# The name of the group
# empty name for a default group in a single-module package
# The name of the group
# empty name for a default group in a single-module package
- redef var name: String
+ redef var name
+
+ redef var location
# The enclosing package
var mpackage: MPackage
# The enclosing package
var mpackage: MPackage
@@
-74,12
+81,15
@@
class MGroup
var parent: nullable MGroup
# Fully qualified name.
var parent: nullable MGroup
# Fully qualified name.
- # It includes each parent group separated by `/`
+ # It includes each parent group separated by `>`.
+ # The full_name is terminated by `>` to avoid collision with other entities.
+ #
+ # E.g. `core>` and `core>collection>`
redef fun full_name
do
var p = parent
redef fun full_name
do
var p = parent
- if p == null then return name
- return "{p.full_name}/{name}"
+ if p == null then return "{name}>"
+ return "{p.full_name}{name}>"
end
# The group is the group tree on the package (`mpackage.mgroups`)
end
# The group is the group tree on the package (`mpackage.mgroups`)
@@
-91,7
+101,14
@@
class MGroup
fun is_root: Bool do return mpackage.root == self
# The filepath (usually a directory) of the group, if any
fun is_root: Bool do return mpackage.root == self
# The filepath (usually a directory) of the group, if any
- var filepath: nullable String = null is writable
+ #
+ # safe alias to `location.file.filename`
+ fun filepath: nullable String do
+ var res
+ res = self.location.file
+ if res == null then return null
+ return res.filename
+ end
init
do
init
do