X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=typescript_strings.py;h=f181f56f83ba9388f04add3ecb2e5750ea00906f;hb=1f7e7b116b79f603bb847a8c8efbb9f1b70200ed;hp=76e43828913cc71225f65eebfab8d336a5c1a574;hpb=8f8b6aaddcb1dad3d708327c78850cdb30f2a64b;p=ldk-java diff --git a/typescript_strings.py b/typescript_strings.py index 76e43828..f181f56f 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -326,6 +326,10 @@ export class UInt5 { return this.val; } } + +export class UnqualifiedError { + public constructor(val: number) {} +} """ self.txout_defn = """export class TxOut extends CommonBase { @@ -592,7 +596,7 @@ jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() { }""" self.hu_struct_file_prefix = """ -import { CommonBase, UInt5 } from './CommonBase.mjs'; +import { CommonBase, UInt5, UnqualifiedError } from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' """ @@ -1085,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", "")