compiler: add `--dir` to just change the output directory
[nit.git] / src / naive_interpreter.nit
index e9d0a97..a579aa2 100644 (file)
@@ -716,6 +716,12 @@ redef class AMethPropdef
                        else if pname == "rand" then
                                var res = recvval.rand
                                return v.int_instance(res)
+                       else if pname == "bin_and" then
+                               return v.int_instance(args[0].to_i.bin_and(args[1].to_i))
+                       else if pname == "bin_or" then
+                               return v.int_instance(args[0].to_i.bin_or(args[1].to_i))
+                       else if pname == "bin_xor" then
+                               return v.int_instance(args[0].to_i.bin_xor(args[1].to_i))
                        else if pname == "native_int_to_s" then
                                return v.native_string_instance(recvval.to_s)
                        else if pname == "strerror_ext" then
@@ -794,6 +800,9 @@ redef class AMethPropdef
                                return v.bool_instance(args[0].to_f.is_inf != 0)
                        end
                else if cname == "NativeString" then
+                       if pname == "init" then
+                               return v.native_string_instance("!" * args[1].to_i)
+                       end
                        var recvval = args.first.val.as(Buffer)
                        if pname == "[]" then
                                var arg1 = args[1].to_i
@@ -852,6 +861,10 @@ redef class AMethPropdef
                else if pname == "calloc_string" then
                        return v.native_string_instance("!" * args[1].to_i)
                else if cname == "NativeArray" then
+                       if pname == "init" then
+                               var val = new Array[Instance].filled_with(v.null_instance, args[1].to_i)
+                               return new PrimitiveInstance[Array[Instance]](args[0].mtype, val)
+                       end
                        var recvval = args.first.val.as(Array[Instance])
                        if pname == "[]" then
                                if args[1].to_i >= recvval.length or args[1].to_i < 0 then