From fab614b9a36b303ae13e08f62d3a9ab408771245 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 26 Jul 2013 12:09:36 -0400 Subject: [PATCH] modelbuilder: get the management of opt_only_metamodel and opt_only_parse Signed-off-by: Jean Privat --- src/modelbuilder.nit | 11 +++++++++++ src/nit.nit | 2 -- src/nitg.nit | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modelbuilder.nit b/src/modelbuilder.nit index b0a5652..ca12cc1 100644 --- a/src/modelbuilder.nit +++ b/src/modelbuilder.nit @@ -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 diff --git a/src/nit.nit b/src/nit.nit index a658d4d..e3d6f6d 100644 --- a/src/nit.nit +++ b/src/nit.nit @@ -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 diff --git a/src/nitg.nit b/src/nitg.nit index 4ebec61..58bf0f1 100644 --- a/src/nitg.nit +++ b/src/nitg.nit @@ -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 -- 1.7.9.5