Merge: Clean some imports
authorJean Privat <jean@pryen.org>
Thu, 31 Jul 2014 03:54:09 +0000 (23:54 -0400)
committerJean Privat <jean@pryen.org>
Thu, 31 Jul 2014 03:54:09 +0000 (23:54 -0400)
Pull-Request: #630
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/standard/bitset.nit
lib/standard/collection/collection.nit
lib/standard/string.nit
src/model/mmodule.nit
src/modelbuilder.nit
src/naive_interpreter.nit
src/parser/parser.nit
src/parser/xss/main.xss

index 6794dcb..ecef9e5 100644 (file)
@@ -18,8 +18,7 @@
 module bitset
 
 import collection
-import math
-import file
+private import math
 
 in "C header" `{
        #include <assert.h>
index 401c3c9..2e6debe 100644 (file)
 # This module define several collection classes.
 module collection
 
-import abstract_collection
 import range
 import list
-intrude import array # FIXME because of string.nit
+import array
 import sorter
 import hash_collection
 import union_find
index 45e5712..07a7e1f 100644 (file)
@@ -15,7 +15,7 @@
 module string
 
 import math
-intrude import collection # FIXME should be collection::array
+import collection
 
 `{
 #include <stdio.h>
index 648eb49..596ea9d 100644 (file)
@@ -17,7 +17,6 @@
 # modules and module hierarchies in the metamodel
 module mmodule
 
-import poset
 import location
 import mproject
 private import more_collections
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
index 138c7e2..b8f5141 100644 (file)
@@ -22,6 +22,7 @@ import typing
 import auto_super_init
 import frontend
 import common_ffi
+private import parser::tables
 
 redef class ToolContext
        # --discover-call-trace
index c5d09eb..924cb87 100644 (file)
@@ -4,7 +4,7 @@ module parser
 
 intrude import parser_prod
 intrude import parser_work
-import tables
+private import tables
 
 redef class Parser
        redef fun build_reduce_table
index 197883e..00507f9 100644 (file)
@@ -71,7 +71,7 @@ module parser
 
 intrude import parser_prod
 intrude import parser_work
-import tables
+private import tables
 $ call make_parser()
 $ end output