X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Fmain.rs;fp=c-bindings-gen%2Fsrc%2Fmain.rs;h=358e30beead1b34e5ee04f1bda1dbac56cf1b11d;hb=de7d5a4df67ab3b0ebe3912813765621b5c0f177;hp=4572f7d921d405256d67b50d7616cacf8461aa7f;hpb=10b9b312755d839471a40e3bceb7b45cb8448a61;p=ldk-c-bindings diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 4572f7d..358e30b 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1185,8 +1185,19 @@ fn writeln_impl(w: &mut W, w_uses: &mut HashSet { + takes_self = true; + break; + }, + syn::FnArg::Typed(ty) => { + if let syn::Pat::Ident(id) = &*ty.pat { + if format!("{}", id.ident) == "self" { + takes_self = true; + break; + } + } + } } } @@ -1456,10 +1467,23 @@ fn writeln_impl(w: &mut W, w_uses: &mut HashSet { + takes_self = true; + if r.mutability.is_some() { takes_mut_self = true; } + if r.reference.is_none() { takes_owned_self = true; } + break; + }, + syn::FnArg::Typed(ty) => { + if let syn::Pat::Ident(id) = &*ty.pat { + if format!("{}", id.ident) == "self" { + takes_self = true; + if id.mutability.is_some() { takes_mut_self = true; } + if id.by_ref.is_none() { takes_owned_self = true; } + break; + } + } + } } } if !takes_mut_self && !takes_self {