ni_nitdoc: added fast copy past utility to signatures.
[nit.git] / src / nitg.nit
index 24b7a3f..58bf0f1 100644 (file)
@@ -18,7 +18,7 @@
 module nitg
 
 import modelbuilder
-import exprbuilder
+import frontend
 import rapid_type_analysis
 import global_compiler
 import separate_erasure_compiler
@@ -26,6 +26,11 @@ import separate_compiler
 
 # Create a tool context to handle options and paths
 var toolcontext = new ToolContext
+
+# Create a new option for --global
+var opt_global = new OptionBool("Use global compilation", "--global")
+toolcontext.option_context.add_option(opt_global)
+
 # We do not add other options, so process them now!
 toolcontext.process_options
 
@@ -39,14 +44,18 @@ if arguments.is_empty then
        toolcontext.option_context.usage
        return
 end
+if arguments.length > 1 then
+       print "Too much arguments: {arguments.join(" ")}"
+       toolcontext.option_context.usage
+       return
+end
 var progname = arguments.first
 
 # Here we load an process all modules passed on the command line
-var mmodules = modelbuilder.parse_and_build([progname])
-if mmodules.is_empty then return
-modelbuilder.full_propdef_semantic_analysis
+var mmodules = modelbuilder.parse([progname])
 
-if toolcontext.opt_only_metamodel.value then exit(0)
+if mmodules.is_empty then return
+modelbuilder.run_phases
 
 # Here we launch the interpreter on the main module
 assert mmodules.length == 1
@@ -55,8 +64,8 @@ var analysis = modelbuilder.do_rapid_type_analysis(mainmodule)
 
 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
+else if opt_global.value then
        modelbuilder.run_global_compiler(mainmodule, analysis)
+else
+       modelbuilder.run_separate_compiler(mainmodule, analysis)
 end