model: add `MModule::mproject` to simplify clients
authorJean Privat <jean@pryen.org>
Fri, 9 Jan 2015 03:50:17 +0000 (22:50 -0500)
committerJean Privat <jean@pryen.org>
Sat, 10 Jan 2015 02:23:19 +0000 (21:23 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/model/mmodule.nit

index e66f164..2b1e2e5 100644 (file)
@@ -76,6 +76,14 @@ class MModule
        # The group of module in the project if any
        var mgroup: nullable MGroup
 
+       # The project of the module if any
+       # Safe alias for `mgroup.mproject`
+       fun mproject: nullable MProject
+       do
+               var g = mgroup
+               if g == null then return null else return g.mproject
+       end
+
        # The short name of the module
        redef var name: String