]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Correct args passed to supertrait C methods in subtrait impls
authorMatt Corallo <git@bluematt.me>
Sat, 17 Jul 2021 17:39:44 +0000 (17:39 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 28 Jul 2021 17:06:58 +0000 (17:06 +0000)
c-bindings-gen/src/main.rs

index 9693e3d560a04575cf51863ec180ce1d37956434..b08f2348002a1e9f1b9671d493b730756a210e48 100644 (file)
@@ -427,7 +427,9 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
                                                }
                                                write_method_var_decl_body(w, &m.sig, "\t", $type_resolver, Some(&meth_gen_types), true);
                                                write!(w, "(self{}.{})(", $impl_accessor, m.sig.ident).unwrap();
-                                               write_method_call_params(w, &m.sig, "\t", $type_resolver, Some(&meth_gen_types), "", true);
+                                               let mut args = Vec::new();
+                                               write_method_call_params(&mut args, &m.sig, "\t", $type_resolver, Some(&meth_gen_types), "", true);
+                                               w.write_all(String::from_utf8(args).unwrap().replace("self", &format!("self{}", $impl_accessor)).as_bytes()).unwrap();
 
                                                writeln!(w, "\n\t}}").unwrap();
                                        },