@echo '***************************************************************'
@echo '* Generate doc for NIT standard library *'
@echo '***************************************************************'
- bin/nitdoc lib/*.nit $$(find lib/* -maxdepth 0 -type d ) -d doc/stdlib \
+ bin/nitdoc lib/*.nit $$(find lib/*/*.nit -maxdepth 0 -type f ) -d doc/stdlib \
--custom-title "Nit Standard Library" \
--custom-menu-items "<li><a href=\"http://nitlanguage.org/\">Nitlanguage.org</a></li>" \
--custom-overview-text "<p>Documentation for the standard library of Nit<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
return path
end
+ # loaded module by absolute path
+ private var loaded_nmodules = new HashMap[String, AModule]
+
# Try to load a module using a path.
# Display an error if there is a problem (IO / lexer / parser) and return null
# Note: usually, you do not need this method, use `get_mmodule_by_name` instead.
fun load_module(owner: nullable MModule, filename: String): nullable AModule
do
+ if filename.file_extension != "nit" then
+ self.toolcontext.error(null, "Error: file {filename} is not a valid nit module.")
+ return null
+ end
if not filename.file_exists then
self.toolcontext.error(null, "Error: file {filename} not found.")
return null
end
+ var module_path = module_absolute_path(filename)
+ if loaded_nmodules.keys.has(module_path) then
+ return loaded_nmodules[module_path]
+ end
+
var x = if owner != null then owner.to_s else "."
self.toolcontext.info("load module {filename} in {x}", 2)
nmodule.mmodule = mmodule
nmodules.add(nmodule)
self.mmodule2nmodule[mmodule] = nmodule
+ self.loaded_nmodules[module_path] = nmodule
build_module_importation(nmodule)