else:
assert False
+ def check_c_arr_null(self, arr_name):
+ return arr_name + " != 0"
+
def constr_hu_array(self, ty_info, arr_len):
base_ty = ty_info.subty.java_hu_ty.split("[")[0].split("<")[0]
conv = "new " + base_ty + "[" + arr_len + "]"
to_hu_conv += ";\n"
pfx = ""
if is_nullable:
- to_hu_conv += "if (" + arr_name + " != null) {\n"
+ to_hu_conv += "if (" + self.consts.check_c_arr_null(arr_name) + ") {\n"
pfx = "\t"
to_hu_conv += pfx + self.consts.for_n_in_range(idxc, "0", conv_name + "_len") + "\n"
return arr_name + ".length"
def get_java_arr_elem(self, elem_ty, arr_name, idx):
return arr_name + "[" + idx + "]"
+ def check_c_arr_null(self, arr_name):
+ return arr_name + " != null"
def constr_hu_array(self, ty_info, arr_len):
base_ty = ty_info.subty.java_hu_ty.split("[")[0].split("<")[0]
conv = "new " + base_ty + "[" + arr_len + "]"
return "bindings.getU32ArrayElem(" + arr_name + ", " + idx + ")"
else:
assert False
+ def check_c_arr_null(self, arr_name):
+ return arr_name + " != 0"
def constr_hu_array(self, ty_info, arr_len):
return "new Array(" + arr_len + ").fill(null)"
def cleanup_converted_native_array(self, ty_info, arr_name):