nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rta: use callsites to do the analysis
[nit.git]
/
src
/
nitg.nit
diff --git
a/src/nitg.nit
b/src/nitg.nit
index
7b442a0
..
47f6373
100644
(file)
--- a/
src/nitg.nit
+++ b/
src/nitg.nit
@@
-19,6
+19,7
@@
module nitg
import modelbuilder
import frontend
import modelbuilder
import frontend
+import transform
import rapid_type_analysis
import global_compiler
import separate_erasure_compiler
import rapid_type_analysis
import global_compiler
import separate_erasure_compiler
@@
-31,6
+32,9
@@
var toolcontext = new ToolContext
var opt_global = new OptionBool("Use global compilation", "--global")
toolcontext.option_context.add_option(opt_global)
var opt_global = new OptionBool("Use global compilation", "--global")
toolcontext.option_context.add_option(opt_global)
+var opt_mixins = new OptionArray("Additionals module to min-in", "-m")
+toolcontext.option_context.add_option(opt_mixins)
+
# We do not add other options, so process them now!
toolcontext.process_options
# We do not add other options, so process them now!
toolcontext.process_options
@@
-53,20
+57,26
@@
var progname = arguments.first
# Here we load an process all modules passed on the command line
var mmodules = modelbuilder.parse([progname])
# Here we load an process all modules passed on the command line
var mmodules = modelbuilder.parse([progname])
+mmodules.add_all modelbuilder.parse(opt_mixins.value)
+
if mmodules.is_empty then return
modelbuilder.run_phases
if mmodules.is_empty then return
modelbuilder.run_phases
-if toolcontext.opt_only_metamodel.value then exit(0)
+var mainmodule
+if mmodules.length == 1 then
+ mainmodule = mmodules.first
+else
+ mainmodule = new MModule(model, null, mmodules.first.name, mmodules.first.location)
+ mainmodule.set_imported_mmodules(mmodules)
+end
-# Here we launch the interpreter on the main module
-assert mmodules.length == 1
-var mainmodule = mmodules.first
-var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
if toolcontext.opt_erasure.value then
if toolcontext.opt_erasure.value then
- modelbuilder.run_separate_erasure_compiler(mainmodule, analysis)
-else if toolcontext.opt_separate.value then
- modelbuilder.run_separate_compiler(mainmodule, analysis)
-else
+ modelbuilder.run_separate_erasure_compiler(mainmodule, null)
+else if opt_global.value then
+ var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
modelbuilder.run_global_compiler(mainmodule, analysis)
modelbuilder.run_global_compiler(mainmodule, analysis)
+else
+ var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
+ modelbuilder.run_separate_compiler(mainmodule, analysis)
end
end