nitc: explicitly cast long to int
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 8 Feb 2017 08:32:19 +0000 (03:32 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 9 Feb 2017 18:25:41 +0000 (13:25 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/compiler/abstract_compiler.nit
src/compiler/global_compiler.nit
src/compiler/separate_compiler.nit

index 7407a20..d608967 100644 (file)
@@ -3057,7 +3057,7 @@ redef class AMethPropdef
                        end
                end
                if pname == "exit" then
-                       v.add("exit({arguments[1]});")
+                       v.add("exit((int){arguments[1]});")
                        return true
                else if pname == "sys" then
                        v.ret(v.new_expr("glob_sys", ret.as(not null)))
index 7b07847..718cb5d 100644 (file)
@@ -405,12 +405,12 @@ class GlobalCompilerVisitor
                return false
        end
 
-       redef fun native_array_instance(elttype: MType, length: RuntimeVariable): RuntimeVariable
+       redef fun native_array_instance(elttype, length)
        do
                var ret_type = mmodule.native_array_type(elttype)
                ret_type = anchor(ret_type).as(MClassType)
                length = autobox(length, compiler.mainmodule.int_type)
-               return self.new_expr("NEW_{ret_type.c_name}({length})", ret_type)
+               return self.new_expr("NEW_{ret_type.c_name}((int){length})", ret_type)
        end
 
        redef fun native_array_get(nat, i)
index c4defe0..e486b64 100644 (file)
@@ -2085,7 +2085,7 @@ class SeparateCompilerVisitor
                return res
        end
 
-       redef fun native_array_instance(elttype: MType, length: RuntimeVariable): RuntimeVariable
+       redef fun native_array_instance(elttype, length)
        do
                var mtype = mmodule.native_array_type(elttype)
                self.require_declaration("NEW_{mtype.mclass.c_name}")
@@ -2098,11 +2098,11 @@ class SeparateCompilerVisitor
                        var recv = self.frame.arguments.first
                        var recv_type_info = self.type_info(recv)
                        self.require_declaration(mtype.const_color)
-                       return self.new_expr("NEW_{mtype.mclass.c_name}({length}, {recv_type_info}->resolution_table->types[{mtype.const_color}])", mtype)
+                       return self.new_expr("NEW_{mtype.mclass.c_name}((int){length}, {recv_type_info}->resolution_table->types[{mtype.const_color}])", mtype)
                end
                compiler.undead_types.add(mtype)
                self.require_declaration("type_{mtype.c_name}")
-               return self.new_expr("NEW_{mtype.mclass.c_name}({length}, &type_{mtype.c_name})", mtype)
+               return self.new_expr("NEW_{mtype.mclass.c_name}((int){length}, &type_{mtype.c_name})", mtype)
        end
 
        redef fun native_array_def(pname, ret_type, arguments)