X-Git-Url: http://nitlanguage.org diff --git a/src/compiler/java_compiler.nit b/src/compiler/java_compiler.nit index f1e3437..7b83104 100644 --- a/src/compiler/java_compiler.nit +++ b/src/compiler/java_compiler.nit @@ -497,7 +497,7 @@ class JavaCompilerVisitor # This method is used to manage varargs in signatures and returns the real array # of runtime variables to use in the call. fun varargize(mpropdef: MMethodDef, map: nullable SignatureMap, recv: RuntimeVariable, args: SequenceRead[AExpr]): Array[RuntimeVariable] do - var msignature = mpropdef.new_msignature or else mpropdef.msignature.as(not null) + var msignature = mpropdef.msignature.as(not null) var res = new Array[RuntimeVariable] res.add(recv) @@ -526,8 +526,8 @@ class JavaCompilerVisitor res.add(null_instance) continue end - if param.is_vararg and map.vararg_decl > 0 then - var vararg = exprs.sub(j, map.vararg_decl) + if param.is_vararg and args[i].vararg_decl > 0 then + var vararg = exprs.sub(j, args[i].vararg_decl) var elttype = param.mtype var arg = self.vararg_instance(mpropdef, recv, vararg, elttype) res.add(arg) @@ -1301,7 +1301,7 @@ redef class MType # Is the associated Java type a primitive one? # - # ENSURE `result == (java_type != "Object")` + # ENSURE `result == (java_type != "RTVal")` var is_java_primitive: Bool is lazy do return java_type != "RTVal" end @@ -1318,7 +1318,7 @@ redef class MClassType return "double" else if mclass.name == "Byte" then return "byte" - else if mclass.name == "NativeString" then + else if mclass.name == "CString" then return "String" else if mclass.name == "NativeArray" then return "Array" @@ -1330,7 +1330,7 @@ end redef class MClass # Runtime name - private fun rt_name: String do return "RTClass_{intro.mmodule.jname}_{jname}" + private fun rt_name: String do return "RTClass_{intro_mmodule.jname}_{jname}" # Generate a Java RTClass for a Nit MClass fun compile_to_java(v: JavaCompilerVisitor) do @@ -1482,8 +1482,7 @@ end redef class AClassdef private fun compile_to_java(v: JavaCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable]) do - if mpropdef == self.mfree_init then - assert mpropdef.mproperty.is_root_init + if mpropdef.mproperty.is_root_init then if not mpropdef.is_intro then v.supercall(mpropdef, arguments.first.mtype.as(MClassType), arguments) end @@ -1588,10 +1587,10 @@ redef class AMethPropdef else if pname == "%" then v.ret(v.new_expr("{arguments[0]} % {arguments[1]}", ret.as(not null))) return true - else if pname == "lshift" then + else if pname == "<<" then v.ret(v.new_expr("{arguments[0]} << {arguments[1]}", ret.as(not null))) return true - else if pname == "rshift" then + else if pname == ">>" then v.ret(v.new_expr("{arguments[0]} >> {arguments[1]}", ret.as(not null))) return true else if pname == "==" then @@ -1692,10 +1691,10 @@ redef class AMethPropdef else if pname == "%" then v.ret(v.new_expr("(byte)({arguments[0]} % {arguments[1]})", ret.as(not null))) return true - else if pname == "lshift" then + else if pname == "<<" then v.ret(v.new_expr("(byte)({arguments[0]} << {arguments[1]})", ret.as(not null))) return true - else if pname == "rshift" then + else if pname == ">>" then v.ret(v.new_expr("(byte)({arguments[0]} >> {arguments[1]})", ret.as(not null))) return true else if pname == "==" then