diff --git a/__main__.py b/__main__.py index 3639ccb..0598114 100644 --- a/__main__.py +++ b/__main__.py @@ -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") diff --git a/code_writer.py b/code_writer.py index ab3d08f..97b000c 100644 --- a/code_writer.py +++ b/code_writer.py @@ -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