loader: add a public itentified_files attribute
authorJean Privat <jean@pryen.org>
Sat, 6 Dec 2014 04:16:57 +0000 (23:16 -0500)
committerJean Privat <jean@pryen.org>
Tue, 9 Dec 2014 01:18:23 +0000 (20:18 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit
src/nitls.nit

index 5edd243..14ec4fe 100644 (file)
@@ -208,7 +208,11 @@ redef class ModelBuilder
        end
 
        # Cache for `identify_file` by realpath
-       private var identified_files = new HashMap[String, nullable ModulePath]
+       private var identified_files_by_path = new HashMap[String, nullable ModulePath]
+
+       # All the currently identified modules.
+       # See `identify_file`.
+       var identified_files = new Array[ModulePath]
 
        # Identify a source file
        # Load the associated project and groups if required
@@ -243,7 +247,7 @@ redef class ModelBuilder
                # Fast track, the path is already known
                var pn = path.basename(".nit")
                var rp = module_absolute_path(path)
-               if identified_files.has_key(rp) then return identified_files[rp]
+               if identified_files_by_path.has_key(rp) then return identified_files_by_path[rp]
 
                # Search for a group
                var mgrouppath = path.join_path("..").simplify_path
@@ -261,7 +265,8 @@ redef class ModelBuilder
                var res = new ModulePath(pn, path, mgroup)
                mgroup.module_paths.add(res)
 
-               identified_files[rp] = res
+               identified_files_by_path[rp] = res
+               identified_files.add(res)
                return res
        end
 
index f29fdfd..c6c62b8 100644 (file)
@@ -194,8 +194,7 @@ for a in files do
 end
 
 # Load modules to get more informations
-for mp in mb.identified_files.values do
-       if mp == null then continue
+for mp in mb.identified_files do
        if not opt_paths.value or opt_depends.value then
                var mm = mb.load_module(mp.filepath)
                if mm != null and opt_depends.value then