if nmodule == null then continue # Skip error
# Load imported module
build_module_importation(nmodule)
-
- mmodules.add(nmodule.mmodule.as(not null))
+ var mmodule = nmodule.mmodule
+ if mmodule == null then continue # skip error
+ mmodules.add mmodule
end
var time1 = get_time
self.toolcontext.info("*** END PARSE: {time1-time0} ***", 2)
if nmodule == null then continue # Skip error
# Load imported module
build_module_importation(nmodule)
-
- res.add(nmodule.mmodule.as(not null))
+ var mmodule = nmodule.mmodule
+ if mmodule == null then continue # Skip error
+ res.add mmodule
end
end
return res
var nmodule = self.load_module(af)
if nmodule == null then continue # Skip error
build_module_importation(nmodule)
- mmodules.add(nmodule.mmodule.as(not null))
+ var mmodule = nmodule.mmodule
+ if mmodule == null then continue # Skip error
+ mmodules.add mmodule
else
self.toolcontext.info("ignore file {af}", 2)
end
if nmodule == null then continue # Skip error
# Load imported module
build_module_importation(nmodule)
-
- mmodules.add(nmodule.mmodule.as(not null))
+ var mmodule = nmodule.mmodule
+ if mmodule == null then continue # Skip error
+ mmodules.add mmodule
end
var time1 = get_time
self.toolcontext.info("*** END PARSE: {time1-time0} ***", 2)
if res == null then return null # Forward error
# Load imported module
build_module_importation(res)
- return res.mmodule.as(not null)
+ return res.mmodule
end
# Search a module `name` from path `lookpaths`.
return mgroups[rdp]
end
- # Hack, a group is determined by:
+ # Hack, a group is determined by one of the following:
# * the presence of a honomymous nit file
# * the fact that the directory is named `src`
+ # * the fact that there is a sub-directory named `src`
var pn = rdp.basename(".nit")
var mp = dirpath.join_path(pn + ".nit").simplify_path
+ # dirpath2 is the root directory
+ # dirpath is the src subdirectory directory, if any, else it is the same that dirpath2
var dirpath2 = dirpath
if not mp.file_exists then
if pn == "src" then
dirpath2 = rdp.dirname
pn = dirpath2.basename("")
else
- return null
+ # Check a `src` subdirectory
+ dirpath = dirpath2 / "src"
+ if not dirpath.file_exists then
+ # All rules failed, so return null
+ return null
+ end
end
end
# check parent directory
- var parentpath = dirpath.join_path("..").simplify_path
+ var parentpath = dirpath2.join_path("..").simplify_path
var parent = get_mgroup(parentpath)
var mgroup
end
mgroup.filepath = dirpath
- mgroups[rdp] = mgroup
+ mgroups[module_absolute_path(dirpath)] = mgroup
+ mgroups[module_absolute_path(dirpath2)] = mgroup
return mgroup
end