From: Jean Privat Date: Mon, 19 Oct 2015 12:50:24 +0000 (-0400) Subject: Merge: Loader refactor X-Git-Tag: v0.7.9~29 X-Git-Url: http://nitlanguage.org?hp=-c Merge: Loader refactor A big refactorization of the loader This include cleanup, renaming and documentation of the existing code. The major change is the removal of `ModulePath` used to designate an identified module that is not yet loaded. This caused major issues since once the module was loaded, the MModule object has to be used instead. Now, genuine `MModule` are used to also represent modules identified in the file system but not yet loaded. This simplify the code of the loader, nitls and nitcatalog. By the way, the option `-d` (and `-M`) of nitls that was broken by the previous changes in the loader is now fixed. Another change is the introduction of `scan_full` that is a high-level method to be used by clients like nitls or nitcatalog that just need to identify packages, groups and modules in the filesystem without loading them. By the way, nitcalatog works on directories of projects now. eg. `nitcatalog ../lib) Note, because this PR introduces a lot of interrelated changes, It was hard to come up with nice commits. The alternative was to have a single big commit. Pull-Request: #1750 Reviewed-by: Alexis Laferrière Reviewed-by: Lucas Bajolet --- 7743ff7bb65c42ce0c56445fcfb15e3f0987d61e diff --combined contrib/online_ide/sources/nit/pnacl_nit.nit index 567b0a2,9522036..122b507 --- a/contrib/online_ide/sources/nit/pnacl_nit.nit +++ b/contrib/online_ide/sources/nit/pnacl_nit.nit @@@ -17,11 -17,11 +17,11 @@@ # A version of the naive Nit interpreter for PNaCl. module pnacl_nit -import interpreter::naive_interpreter -import interpreter::debugger +import nitc::interpreter::naive_interpreter +import nitc::interpreter::debugger import pnacl -intrude import toolcontext -intrude import loader +intrude import nitc::toolcontext +intrude import nitc::loader intrude import core::file # We redefine exit to start a new thread before killing the one that called exit. @@@ -97,7 -97,7 +97,7 @@@ redef class ModelBuilde redef fun module_absolute_path(path: String): String do return path # We don't use paths as the interpreter, so we don't use location or lookpaths args (see the default implementation). - redef fun search_module_in_paths(location: nullable Location, name: String, lookpaths: Collection[String]): nullable ModulePath + redef fun search_module_in_paths(location: nullable Location, name: String, lookpaths: Collection[String]): nullable MModule do var candidate: nullable String = null var try_file = "{name}.nit" @@@ -114,7 -114,7 +114,7 @@@ end end if candidate == null then return null - return identify_file(candidate) + return identify_module(candidate) end end