Merge: Nitsmell : Adding new code smells and print console updated
[nit.git] / src / loader.nit
index deb895a..1502c40 100644 (file)
@@ -742,7 +742,7 @@ redef class ModelBuilder
 
        # Injection of a new module without source.
        # Used by the interpreter.
-       fun load_rt_module(parent: nullable MModule, nmodule: AModule, mod_name: String): nullable AModule
+       fun load_rt_module(parent: nullable MModule, nmodule: AModule, mod_name: String): nullable MModule
        do
                # Create the module
 
@@ -759,11 +759,10 @@ redef class ModelBuilder
                        imported_modules.add(parent)
                        mmodule.set_visibility_for(parent, intrude_visibility)
                        mmodule.set_imported_mmodules(imported_modules)
-               else
-                       build_module_importation(nmodule)
                end
+               build_module_importation(nmodule)
 
-               return nmodule
+               return mmodule
        end
 
        # Visit the AST and create the `MModule` object
@@ -813,6 +812,8 @@ redef class ModelBuilder
                        end
                        # Is the module a test suite?
                        mmodule.is_test_suite = not decl.get_annotations("test_suite").is_empty
+                       # Is the module generated?
+                       mmodule.is_generated = not decl.get_annotations("generated").is_empty
                end
        end
 
@@ -1045,7 +1046,7 @@ redef class ModelBuilder
        # (and `build_module_importation` that calls it).
        #
        # TODO (when the loader will be rewritten): use a better representation and move up rules in the model.
-       private var conditional_importations = new Array[SequenceRead[MModule]]
+       var conditional_importations = new Array[SequenceRead[MModule]]
 
        # Extends the current importations according to imported rules about conditional importation
        fun apply_conditional_importations(mmodule: MModule)