nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
global_compiler: remove a useless local variable
[nit.git]
/
src
/
compiler
/
global_compiler.nit
diff --git
a/src/compiler/global_compiler.nit
b/src/compiler/global_compiler.nit
index
1aff84e
..
273d645
100644
(file)
--- a/
src/compiler/global_compiler.nit
+++ b/
src/compiler/global_compiler.nit
@@
-246,8
+246,7
@@
class GlobalCompiler
var res = v.new_var(mtype)
res.is_exact = true
if is_native_array then
var res = v.new_var(mtype)
res.is_exact = true
if is_native_array then
- var mtype_elt = mtype.arguments.first
- v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}) + length*sizeof({mtype_elt.ctype}));")
+ v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}) + length*sizeof(val*));")
v.add("((struct {mtype.c_name}*){res})->length = length;")
else
v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}));")
v.add("((struct {mtype.c_name}*){res})->length = length;")
else
v.add("{res} = nit_alloc(sizeof(struct {mtype.c_name}));")
@@
-404,6
+403,7
@@
class GlobalCompilerVisitor
do
var ret_type = mmodule.native_array_type(elttype)
ret_type = anchor(ret_type).as(MClassType)
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)
end
return self.new_expr("NEW_{ret_type.c_name}({length})", ret_type)
end
@@
-528,11
+528,6
@@
class GlobalCompilerVisitor
private fun get_recvtype(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): MClassType
do
check_valid_reciever(recvtype)
private fun get_recvtype(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): MClassType
do
check_valid_reciever(recvtype)
- #debug("call {m} on {recvtype} on {args.first}:{args.first.mtype}")
- if m.mproperty.is_toplevel then
- # Do not customize top-level methods
- recvtype = m.mclassdef.bound_mtype
- end
return recvtype
end
return recvtype
end