# Return the mgroup associated to a directory path.
# If the directory is not a group null is returned.
+ #
+ # Note: `paths` is also used to look for mgroups
fun get_mgroup(dirpath: String): nullable MGroup
do
+ if not dirpath.file_exists then do
+ for p in paths do
+ var try = p / dirpath
+ if try.file_exists then
+ dirpath = try
+ break label
+ end
+ end
+ return null
+ end label
+
var rdp = module_absolute_path(dirpath)
if mgroups.has_key(rdp) then
return mgroups[rdp]
nmodules.add(nmodule)
self.mmodule2nmodule[mmodule] = nmodule
+ var source = nmodule.location.file
+ if source != null then
+ assert source.mmodule == null
+ source.mmodule = mmodule
+ end
+
if decl != null then
+ # Extract documentation
var ndoc = decl.n_doc
if ndoc != null then
var mdoc = ndoc.to_mdoc
else
advice(decl, "missing-doc", "Documentation warning: Undocumented module `{mmodule}`")
end
+ # Is the module a test suite?
+ mmodule.is_test_suite = not decl.get_annotations("test_suite").is_empty
end
return mmodule
end
+redef class SourceFile
+ # Associated mmodule, once created
+ var mmodule: nullable MModule = null
+end
+
redef class AStdImport
# The imported module once determined
var mmodule: nullable MModule = null