loader: extract `load_module_path` from `get_mmodule_by_name`
authorJean Privat <jean@pryen.org>
Tue, 21 Jul 2015 17:40:12 +0000 (13:40 -0400)
committerJean Privat <jean@pryen.org>
Tue, 21 Jul 2015 20:33:42 +0000 (16:33 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit

index 4aaa72d..7269b93 100644 (file)
@@ -272,6 +272,14 @@ redef class ModelBuilder
        do
                var path = search_mmodule_by_name(anode, mgroup, name)
                if path == null then return null # Forward error
+               return load_module_path(path)
+       end
+
+       # Load and process importation of a given ModulePath.
+       #
+       # Basically chains `load_module` and `build_module_importation`.
+       fun load_module_path(path: ModulePath): nullable MModule
+       do
                var res = self.load_module(path.filepath)
                if res == null then return null # Forward error
                # Load imported module