nitls: parse options before instantiating modelbuilder
authorJean Privat <jean@pryen.org>
Fri, 25 Apr 2014 02:25:47 +0000 (22:25 -0400)
committerJean Privat <jean@pryen.org>
Fri, 25 Apr 2014 02:25:47 +0000 (22:25 -0400)
Because things, eg paths, may depend on options,

Signed-off-by: Jean Privat <jean@pryen.org>

src/nitls.nit

index 1709c56..0b8add6 100644 (file)
@@ -46,8 +46,6 @@ class ProjTree
 end
 
 var tc = new ToolContext
-var model = new Model
-var mb = new ModelBuilder(model, tc)
 
 var opt_keep = new OptionBool("Ignore errors and files that are not a Nit source file", "-k", "--keep")
 var opt_recursive = new OptionBool("Process directories recussively", "-r", "--recursive")
@@ -75,6 +73,9 @@ if sum > 1 then
        exit 1
 end
 
+var model = new Model
+var mb = new ModelBuilder(model, tc)
+
 if opt_depends.value then
        if opt_recursive.value then
                print "-M incompatible with -r"