From: Matt Corallo Date: Fri, 15 Apr 2022 01:25:56 +0000 (+0000) Subject: [TS] Implement trait_struct_inc_refcnt properly (identical to java) X-Git-Tag: v0.0.106.0~1^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=66030b8fbc36750cd03856b427e20bb600a6f7a1;p=ldk-java [TS] Implement trait_struct_inc_refcnt properly (identical to java) --- diff --git a/typescript_strings.py b/typescript_strings.py index 670eb2ae..f181f56f 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -1089,7 +1089,10 @@ export class {struct_name.replace("LDK","")} extends CommonBase {{ return (out_typescript_bindings, out_typescript_human, out_c) def trait_struct_inc_refcnt(self, ty_info): - return "" + base_conv = "\nif (" + ty_info.var_name + "_conv.free == " + ty_info.rust_obj + "_JCalls_free) {\n" + base_conv = base_conv + "\t// If this_arg is a JCalls struct, then we need to increment the refcnt in it.\n" + base_conv = base_conv + "\t" + ty_info.rust_obj + "_JCalls_cloned(&" + ty_info.var_name + "_conv);\n}" + return base_conv def map_complex_enum(self, struct_name, variant_list, camel_to_snake, enum_doc_comment): bindings_type = struct_name.replace("LDK", "")