modelbuilder: get the management of opt_only_metamodel and opt_only_parse
authorJean Privat <jean@pryen.org>
Fri, 26 Jul 2013 16:09:36 +0000 (12:09 -0400)
committerJean Privat <jean@pryen.org>
Fri, 26 Jul 2013 16:09:36 +0000 (12:09 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelbuilder.nit
src/nit.nit
src/nitg.nit

index b0a5652..ca12cc1 100644 (file)
@@ -70,6 +70,11 @@ class ModelBuilder
                        nmodules.add(mmodule2nmodule[mm])
                end
                toolcontext.run_phases(nmodules)
+
+               if toolcontext.opt_only_metamodel.value then
+                       self.toolcontext.info("*** ONLY METAMODEL", 1)
+                       exit(0)
+               end
        end
 
        # Instantiate a modelbuilder for a model and a toolcontext
@@ -121,6 +126,12 @@ class ModelBuilder
                self.toolcontext.info("*** END PARSE: {time1-time0} ***", 2)
 
                self.toolcontext.check_errors
+
+               if toolcontext.opt_only_parse.value then
+                       self.toolcontext.info("*** ONLY PARSE...", 1)
+                       exit(0)
+               end
+
                return mmodules
        end
 
index a658d4d..e3d6f6d 100644 (file)
@@ -47,8 +47,6 @@ var progname = arguments.first
 var mmodules = modelbuilder.parse([progname])
 modelbuilder.run_phases
 
-if toolcontext.opt_only_metamodel.value then exit(0)
-
 # Here we launch the interpreter on the main module
 assert mmodules.length == 1
 var mainmodule = mmodules.first
index 4ebec61..58bf0f1 100644 (file)
@@ -53,11 +53,10 @@ var progname = arguments.first
 
 # Here we load an process all modules passed on the command line
 var mmodules = modelbuilder.parse([progname])
+
 if mmodules.is_empty then return
 modelbuilder.run_phases
 
-if toolcontext.opt_only_metamodel.value then exit(0)
-
 # Here we launch the interpreter on the main module
 assert mmodules.length == 1
 var mainmodule = mmodules.first