X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=gen_type_mapping.py;fp=gen_type_mapping.py;h=d24ed230208d33a3742bc151007ebca890b8cfea;hp=c5a434ac69dfd2a2d5b5bf4a28f2c6c422d6dbab;hb=f800f9f0b95aa0f37671414397dbe7f876e298c8;hpb=b3a23d8dae8cc969fce9cad64991b393f74c94af diff --git a/gen_type_mapping.py b/gen_type_mapping.py index c5a434ac..d24ed230 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -429,7 +429,6 @@ class TypeMappingGenerator: # underlying unlike Vecs, and it gives Java more freedom. base_conv = base_conv + "\nFREE(untag_ptr(" + ty_info.var_name + "));" if ty_info.rust_obj in self.complex_enums: - to_hu_conv_sfx = "" if needs_full_clone and (ty_info.rust_obj.replace("LDK", "") + "_clone") not in self.clone_fns: # We really need a full clone here, but for now we just implement # a manual clone explicitly for Options @@ -437,7 +436,6 @@ class TypeMappingGenerator: assert ty_info.rust_obj.startswith("LDKCOption") # We don't support contained traits for anything else yet optional_ty = ty_info.rust_obj[11:-1] assert "LDK" + optional_ty in self.trait_structs # We don't support contained traits for anything else yet - to_hu_conv_sfx = self.consts.add_ref("this", ty_info.var_name) base_conv += "\nif (" + ty_info.var_name + "_conv.tag == " + ty_info.rust_obj + "_Some) {" base_conv += "\n\t// Manually implement clone for Java trait instances" optional_ty_info = self.java_c_types("LDK" + optional_ty + " " + ty_info.var_name, None) @@ -451,7 +449,7 @@ class TypeMappingGenerator: ret_conv = (ret_conv[0], ";\n" + self.consts.ptr_c_ty + " " + ty_info.var_name + "_ref = tag_ptr(" + ty_info.var_name + "_copy, true);") if from_hu_conv is None: from_hu_conv = (self.consts.get_ptr(ty_info.var_name), "") - from_hu_conv = (from_hu_conv[0], to_hu_conv_sfx) + from_hu_conv = (from_hu_conv[0], self.consts.add_ref("this", ty_info.var_name)) fully_qualified_ty = self.consts.fully_qualified_hu_ty_path(ty_info) to_hu_call = fully_qualified_ty + ".constr_from_ptr(" + ty_info.var_name + ")" return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,