From 6d91e129539179f578d7d15196dcd1e0492a536f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 8 Feb 2017 03:32:19 -0500 Subject: [PATCH] nitc: explicitly cast long to int MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- src/compiler/abstract_compiler.nit | 2 +- src/compiler/global_compiler.nit | 4 ++-- src/compiler/separate_compiler.nit | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index 7407a20..d608967 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -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))) diff --git a/src/compiler/global_compiler.nit b/src/compiler/global_compiler.nit index 7b07847..718cb5d 100644 --- a/src/compiler/global_compiler.nit +++ b/src/compiler/global_compiler.nit @@ -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) diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index c4defe0..e486b64 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -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) -- 1.7.9.5