modelbuilder: TODO, check for useless importation
authorJean Privat <jean@pryen.org>
Wed, 30 Jul 2014 17:30:56 +0000 (13:30 -0400)
committerJean Privat <jean@pryen.org>
Wed, 30 Jul 2014 17:30:56 +0000 (13:30 -0400)
A stub, useless for anybody except by those who understand what this does
and who are willing to dig into a bunch of false positive.

Signed-off-by: Jean Privat <jean@pryen.org>

src/modelbuilder.nit

index 724d79f..cebbe1b 100644 (file)
@@ -689,6 +689,18 @@ class ModelBuilder
                end
                self.toolcontext.info("{mmodule} imports {imported_modules.join(", ")}", 3)
                mmodule.set_imported_mmodules(imported_modules)
+
+               # TODO: Correctly check for useless importation
+               # It is even doable?
+               var directs = mmodule.in_importation.direct_greaters
+               for nim in nmodule.n_imports do
+                       if not nim isa AStdImport then continue
+                       var im = nim.mmodule
+                       if im == null then continue
+                       if directs.has(im) then continue
+                       # This generates so much noise that it is simpler to just comment it
+                       #warning(nim, "Warning: possible useless importation of {im}")
+               end
        end
 
        # All the loaded modules