Java 8 support

This commit is contained in:
Andrea Cavalli 2020-08-20 14:02:59 +02:00
parent 57bf307579
commit 0fbeb92e25
2 changed files with 4 additions and 4 deletions

View File

@ -109,7 +109,7 @@ def deserialize_native(output: CodeWriter, arg_name, arg_type, null_check: bool
tmp_name = arg_name.split("[")[0] + "Tmp"
output.indent()
output.local_assign(tmp_name, f"new byte[input.readInt()]")
output.local_assign("byte[]", tmp_name, f"new byte[input.readInt()]")
output.newline()
output.indent()
@ -217,7 +217,7 @@ def serialize_native(output: CodeWriter, arg_type: str, arg_name: str, null_chec
output.indent()
tmp_name = arg_name.split("[")[0] + "Tmp"
output.local_assign(tmp_name, f"this.{arg_name}.getBytes(StandardCharsets.UTF_8)")
output.local_assign("byte[]", tmp_name, f"this.{arg_name}.getBytes(StandardCharsets.UTF_8)")
output.newline()
output.indent()
output.call("output.writeInt", f"{tmp_name}.length")

View File

@ -57,8 +57,8 @@ class CodeWriter:
self.fd.write("} else {")
self.indent_depth += 1
def local_assign(self, name: str, value: str):
self.fd.write("var " + name + " = " + value + ";")
def local_assign(self, object_type: str, name: str, value: str):
self.fd.write(object_type + " " + name + " = " + value + ";")
def open_for(self, start: str, cond: str, stmt: str):
self.indent_depth += 1