From 45a870e9b5bc9fdb3f363cf54d5c7c3e47989635 Mon Sep 17 00:00:00 2001 From: Ryan Levick Date: Thu, 19 Sep 2019 14:31:13 +0200 Subject: [PATCH] Fix recursive call --- macros/com_interface_attribute/src/com_interface_impl.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macros/com_interface_attribute/src/com_interface_impl.rs b/macros/com_interface_attribute/src/com_interface_impl.rs index 1f5cf78..53fd6a0 100644 --- a/macros/com_interface_attribute/src/com_interface_impl.rs +++ b/macros/com_interface_attribute/src/com_interface_impl.rs @@ -10,15 +10,16 @@ pub fn generate(trait_item: &ItemTrait) -> HelperTokenStream { let vptr_ident = vptr::ident(&interface_ident.to_string()); let iid_ident = iid::ident(interface_ident); let vtable_macro = vtable_macro::ident(&interface_ident); + let iid_check = quote! { com::_winapi::shared::guiddef::IsEqualGUID(riid, &Self::IID) }; let recursive_iid_check = if let Some(TypeParamBound::Trait(t)) = trait_item.supertraits.first() { let supertrait_ident = t.path.get_ident().unwrap(); - quote!(com::_winapi::shared::guiddef::IsEqualGUID(riid, &Self::IID) | #supertrait_ident::is_iid_in_inheritance_chain(riid)) + quote! { #iid_check || ::is_iid_in_inheritance_chain(riid) } } else { - quote!(com::_winapi::shared::guiddef::IsEqualGUID(riid, &Self::IID)) + iid_check }; - quote!( + quote! { unsafe impl com::ComInterface for dyn #interface_ident { type VTable = #vtable_ident; type VPtr = #vptr_ident; @@ -34,5 +35,5 @@ pub fn generate(trait_item: &ItemTrait) -> HelperTokenStream { #vtable_macro!(C, O) } } - ) + } }