niti: implements native `chdir` and `mkdir` with a return value
authorJean Privat <jean@pryen.org>
Fri, 10 Apr 2015 10:09:18 +0000 (17:09 +0700)
committerJean Privat <jean@pryen.org>
Fri, 10 Apr 2015 10:09:18 +0000 (17:09 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/interpreter/naive_interpreter.nit

index 8818874..1232a65 100644 (file)
@@ -1001,11 +1001,11 @@ redef class AMethPropdef
                        else if pname == "file_exists" then
                                return v.bool_instance(recvval.to_s.file_exists)
                        else if pname == "file_mkdir" then
-                               recvval.to_s.mkdir
-                               return null
+                               var res = recvval.to_s.mkdir
+                               return v.bool_instance(res == null)
                        else if pname == "file_chdir" then
-                               recvval.to_s.chdir
-                               return null
+                               var res = recvval.to_s.chdir
+                               return v.bool_instance(res == null)
                        else if pname == "file_realpath" then
                                return v.native_string_instance(recvval.to_s.realpath)
                        else if pname == "get_environ" then