toolcontext: nit_dir is non-nullable
authorJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 02:26:40 +0000 (21:26 -0500)
committerJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 02:26:40 +0000 (21:26 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/android_platform.nit
src/doc/doc_pages.nit
src/modelbuilder.nit
src/testing/testing_doc.nit
src/testing/testing_suite.nit
src/toolcontext.nit

index 6fec966..55468fd 100644 (file)
@@ -205,8 +205,8 @@ $(call import-module,android/native_app_glue)
                # libpng is not available on Android NDK
                # FIXME make obtionnal when we have alternatives to mnit
                var nit_dir = toolcontext.nit_dir
-               var share_dir =  "{nit_dir or else ""}/share/"
-               if nit_dir == null or not share_dir.file_exists then
+               var share_dir =  nit_dir/"share/"
+               if not share_dir.file_exists then
                        print "Android project error: Nit share directory not found, please use the environment variable NIT_DIR"
                        exit 1
                end
index 73ae262..c8d1f30 100644 (file)
@@ -115,11 +115,7 @@ class Nitdoc
                var sharedir = ctx.opt_sharedir.value
                if sharedir == null then
                        var dir = ctx.nit_dir
-                       if dir == null then
-                               print "Error: Cannot locate nitdoc share files. Uses --sharedir or envvar NIT_DIR"
-                               abort
-                       end
-                       sharedir = "{dir}/share/nitdoc"
+                       sharedir = dir/"share/nitdoc"
                        if not sharedir.file_exists then
                                print "Error: Cannot locate nitdoc share files. Uses --sharedir or envvar NIT_DIR"
                                abort
index cc613f3..6bf0085 100644 (file)
@@ -141,10 +141,8 @@ class ModelBuilder
                end
 
                var nit_dir = toolcontext.nit_dir
-               if nit_dir != null then
-                       var libname = "{nit_dir}/lib"
-                       if libname.file_exists then paths.add(libname)
-               end
+               var libname = "{nit_dir}/lib"
+               if libname.file_exists then paths.add(libname)
        end
 
        # Load a bunch of modules.
index 566e014..f4061c7 100644 (file)
@@ -127,8 +127,8 @@ class NitUnitExecutor
                if toolcontext.opt_noact.value then return
 
                var nit_dir = toolcontext.nit_dir
-               var nitg = "{nit_dir or else ""}/bin/nitg"
-               if nit_dir == null or not nitg.file_exists then
+               var nitg = nit_dir/"bin/nitg"
+               if not nitg.file_exists then
                        toolcontext.error(null, "Cannot find nitg. Set envvar NIT_DIR.")
                        toolcontext.check_errors
                end
index 5936038..1a3006d 100644 (file)
@@ -214,8 +214,8 @@ class TestCase
        fun compile do
                # find nitg
                var nit_dir = toolcontext.nit_dir
-               var nitg = "{nit_dir or else ""}/bin/nitg"
-               if nit_dir == null or not nitg.file_exists then
+               var nitg = nit_dir/"bin/nitg"
+               if not nitg.file_exists then
                        toolcontext.error(null, "Cannot find nitg. Set envvar NIT_DIR.")
                        toolcontext.check_errors
                end
index bcf571f..0994271 100644 (file)
@@ -402,7 +402,7 @@ The Nit language documentation and the source code of its tools and libraries ma
        end
 
        # The identified root directory of the Nit project
-       var nit_dir: nullable String = null
+       var nit_dir: String is noinit
 
        private fun compute_nit_dir: String
        do