From 44d2c207c81b0f4eb1a460267b699c497e87cb10 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 12 Sep 2023 19:34:48 +0200 Subject: [PATCH] Simplify __declare_class_register_out! --- crates/objc2/src/macros/declare_class.rs | 43 ++---------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/crates/objc2/src/macros/declare_class.rs b/crates/objc2/src/macros/declare_class.rs index 458315a65..eab6be01a 100644 --- a/crates/objc2/src/macros/declare_class.rs +++ b/crates/objc2/src/macros/declare_class.rs @@ -1178,7 +1178,6 @@ macro_rules! __convert_result { #[doc(hidden)] #[macro_export] macro_rules! __declare_class_register_out { - // #[method(...)] { ($builder:ident) ($($qualifiers:tt)*) @@ -1192,51 +1191,15 @@ macro_rules! __declare_class_register_out { ($($__params_prefix:tt)*) ($($params_rest:tt)*) - (#[method($($sel:tt)*)]) - () - ($($m_optional:tt)*) - ($($m_checked:tt)*) - } => { - $crate::__extract_and_apply_cfg_attributes! { - ($($m_checked)*) - - $crate::__declare_class_invalid_selectors!(#[method($($sel)*)]); - $crate::__extern_methods_no_optional!($($m_optional)*); - - $builder.$builder_method( - $crate::sel!($($sel)*), - Self::$name as $crate::__fn_ptr! { - ($($qualifiers)*) - (_, _,) - $($params_rest)* - }, - ); - } - }; - - // #[method_id(...)] - { - ($builder:ident) - ($($qualifiers:tt)*) - ($name:ident) - ($($__ret:ty)?) - ($__body:block) - - ($builder_method:ident) - ($__receiver:expr) - ($__receiver_ty:ty) - ($($__params_prefix:tt)*) - ($($params_rest:tt)*) - - (#[method_id($($sel:tt)*)]) - () // Retain semantics unsupported in declare_class! + (#[$method_or_method_id:ident($($sel:tt)*)]) + ($($retain_semantics:tt)*) ($($m_optional:tt)*) ($($m_checked:tt)*) } => { $crate::__extract_and_apply_cfg_attributes! { ($($m_checked)*) - $crate::__declare_class_invalid_selectors!(#[method_id($($sel)*)]); + $crate::__declare_class_invalid_selectors!(#[$method_or_method_id($($sel)*)]); $crate::__extern_methods_no_optional!($($m_optional)*); $builder.$builder_method(