X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=typescript_strings.py;h=ab7bd54a60d74e9491cce4344d9195e28afb40a6;hb=e498223de1e56484096f3e4d2d9f2bf0468fb328;hp=621b62eebe04af7bf31d3502273c16d58a6f0603;hpb=18a58ec41f1775502365e58fe0e8bc467755c33a;p=ldk-java diff --git a/typescript_strings.py b/typescript_strings.py index 621b62ee..ab7bd54a 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -97,6 +97,9 @@ export default class CommonBase { finalizer.register(this, get_freeer(ptr, free_fn)); } } + protected static add_ref_from(holder: CommonBase, referent: object) { + holder.ptrs_to.push(referent); + } public _test_only_get_ptr(): number { return this.ptr; } } """ @@ -516,6 +519,9 @@ const decodeString = (stringPointer, free = true) => { def var_decl_statement(self, ty_string, var_name, statement): return "const " + var_name + ": " + ty_string + " = " + statement + def add_ref(self, holder, referent): + return "CommonBase.add_ref_from(" + holder + ", " + referent + ")" + def native_c_unitary_enum_map(self, struct_name, variants, enum_doc_comment): out_c = "static inline LDK" + struct_name + " LDK" + struct_name + "_from_js(int32_t ord) {\n" out_c = out_c + "\tswitch (ord) {\n"