# FIXME add missing error checks
module modelbuilder
-import parser
import model
-import poset
-import opts
-import toolcontext
import phase
private import more_collections
mainmodule = mmodules.first
else
# We need a main module, so we build it by importing all modules
- mainmodule = new MModule(modelbuilder.model, null, mmodules.first.name, new Location(null, 0, 0, 0, 0))
+ mainmodule = new MModule(modelbuilder.model, null, mmodules.first.name, new Location(mmodules.first.location.file, 0, 0, 0, 0))
+ mainmodule.is_fictive = true
mainmodule.set_imported_mmodules(mmodules)
end
for phase in phases_list do
var mdoc = ndoc.to_mdoc
mmodule.mdoc = mdoc
mdoc.original_mentity = mmodule
+ else
+ advice(decl, "missing-doc", "Documentation warning: Undocumented module `{mmodule}`")
end
end
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
# Helper function to display a warning on a node.
# Alias for: `self.toolcontext.warning(n.hot_location, text)`
- fun warning(n: ANode, text: String)
+ fun warning(n: ANode, tag, text: String)
+ do
+ self.toolcontext.warning(n.hot_location, tag, text)
+ end
+
+ # Helper function to display an advice on a node.
+ # Alias for: `self.toolcontext.advice(n.hot_location, text)`
+ fun advice(n: ANode, tag, text: String)
do
- self.toolcontext.warning(n.hot_location, text)
+ self.toolcontext.advice(n.hot_location, tag, text)
end
# Force to get the primitive method named `name` on the type `recv` or do a fatal error on `n`