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
# 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
-# Here we launch the interpreter on the main module
-assert mmodules.length == 1
-var mainmodule = mmodules.first
+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
+
var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
if toolcontext.opt_erasure.value then
--global base_simple3.nit -o out/nitg-base_simple3 ; out/nitg-base_simple3
--separate ../examples/hello_world.nit -o out/nitgs-hello_world ; out/nitgs-hello_world
--separate base_simple3.nit -o out/nitgs-base_simple3 ; out/nitgs-base_simple3
+--global ../examples/hello_world.nit -m test_mixin.nit -o out/nitg-hello_world_mixed ; out/nitg-hello_world_mixed
+--separate ../examples/hello_world.nit -m test_mixin.nit -o out/nitgs-hello_world_mixed ; out/nitgs-hello_world_mixed
--erasure Erase generic types
--no-check-erasure-cast Disable implicit casts on unsafe return with erasure-typing policy (dangerous)
--global Use global compilation
+ -m Additionals module to min-in