loader: rename (and document) `visit_group` as `scan_group`
authorJean Privat <jean@pryen.org>
Tue, 18 Aug 2015 12:29:22 +0000 (08:29 -0400)
committerJean Privat <jean@pryen.org>
Tue, 18 Aug 2015 12:29:22 +0000 (08:29 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit
src/nitls.nit
src/nitserial.nit

index e748a39..f17f9c2 100644 (file)
@@ -96,7 +96,7 @@ redef class ModelBuilder
        fun parse_group(mgroup: MGroup): Array[MModule]
        do
                var res = new Array[MModule]
-               visit_group(mgroup)
+               scan_group(mgroup)
                for mg in mgroup.in_nesting.smallers do
                        for mp in mg.module_paths do
                                var nmodule = self.load_module(mp.filepath)
@@ -505,13 +505,18 @@ redef class ModelBuilder
                return mdoc
        end
 
-       # Force the identification of all ModulePath of the group and sub-groups.
-       fun visit_group(mgroup: MGroup) do
+       # Force the identification of all ModulePath of the group and sub-groups in the file system.
+       #
+       # When a group is scanned, its sub-groups hierarchy is filled (see `MGroup::in_nesting`)
+       # and the potential modules (and nested modules) are identified (see `MGroup::module_paths`).
+       #
+       # Basically, this recursively call `get_mgroup` and `identify_file` on each directory entry.
+       fun scan_group(mgroup: MGroup) do
                var p = mgroup.filepath
                for f in p.files do
                        var fp = p/f
                        var g = get_mgroup(fp)
-                       if g != null then visit_group(g)
+                       if g != null then scan_group(g)
                        identify_file(fp)
                end
        end
index 8755bfe..7bbe3aa 100644 (file)
@@ -175,7 +175,7 @@ for a in files do
        var g = mb.get_mgroup(a)
        var mp = mb.identify_file(a)
        if g != null and not opt_project.value then
-               mb.visit_group(g)
+               mb.scan_group(g)
        end
        if g == null and mp == null then
                # not a group not a module, then look at files in the directory
@@ -183,7 +183,7 @@ for a in files do
                for f in fs do
                        g = mb.get_mgroup(a/f)
                        if g != null and not opt_project.value then
-                               mb.visit_group(g)
+                               mb.scan_group(g)
                        end
                        mp = mb.identify_file(a/f)
                        #print "{a/f}: {mp or else "?"}"
index 2a416ef..fcaf8fb 100644 (file)
@@ -160,7 +160,7 @@ for mmodule in mmodules do
        var importations = null
        var mgroup = mmodule.mgroup
        if toolcontext.opt_depth.value == 1 and mgroup != null then
-               modelbuilder.visit_group mgroup
+               modelbuilder.scan_group mgroup
                target_modules = mgroup.mmodules
        else if toolcontext.opt_depth.value == 2 then
                # project