model: filepath is now just an alias on the location
authorJean Privat <jean@pryen.org>
Fri, 13 May 2016 17:53:50 +0000 (13:53 -0400)
committerJean Privat <jean@pryen.org>
Fri, 13 May 2016 20:38:51 +0000 (16:38 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit
src/model/mmodule.nit
src/model/mpackage.nit

index bf8605f..c79ac76 100644 (file)
@@ -397,7 +397,6 @@ redef class ModelBuilder
 
                var loc = new Location.opaque_file(path)
                var res = new MModule(model, mgroup, pn, loc)
-               res.filepath = path
 
                identified_modules_by_path[rp] = res
                identified_modules_by_path[path] = res
@@ -507,7 +506,6 @@ redef class ModelBuilder
                        mdoc.original_mentity = mgroup
                end
 
-               mgroup.filepath = dirpath
                mgroups[rdp] = mgroup
                return mgroup
        end
index 1b56250..1232352 100644 (file)
@@ -81,7 +81,13 @@ class MModule
        var mgroup: nullable MGroup
 
        # The path of the module source, if any
-       var filepath: nullable String = null is writable
+       #
+       # safe alias to `location.file.filepath`
+       fun filepath: nullable String do
+               var res = self.location.file
+               if res == null then return null
+               return res.filename
+       end
 
        # The package of the module if any
        # Safe alias for `mgroup.mpackage`
index 9273d82..8309b5a 100644 (file)
@@ -98,7 +98,14 @@ class MGroup
        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