Merge: nitc: inject importation
authorJean Privat <jean@pryen.org>
Mon, 6 Feb 2017 13:39:02 +0000 (08:39 -0500)
committerJean Privat <jean@pryen.org>
Mon, 6 Feb 2017 13:39:02 +0000 (08:39 -0500)
Extends the nitc code so a phase can inject new submodules.

The main new method the this PR is `ModelBuilder::inject_module_subimportation` that must be used during the analysis on a module.

Up to now, the module hierarchy was fixed and built by the loader before any phases are run.
The basic way was: 1. load the main module, 2. load its imported modules recursively and build the hierarchy, 3. run the phases on all the loaded modules from the most general to the most specific (top-down)
Now the phases can also extends the module hierarchy while running some phases.
This cause the following changes:
* `run_phase` use a work-list (instead of a simple loop)
* new modules can pop up even for the main module of a program, so a fictive main module is always created
* conditional_importations is extended to be used to by inject_module_subimportation.

Pull-Request: #2357
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Jean-Christophe Beaupré <jcbrinfo.public@gmail.com>


Trivial merge