Skip to content

Commit

Permalink
Simplify __declare_class_register_out!
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 12, 2023
1 parent 4fb770b commit 44d2c20
Showing 1 changed file with 3 additions and 40 deletions.
43 changes: 3 additions & 40 deletions crates/objc2/src/macros/declare_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,6 @@ macro_rules! __convert_result {
#[doc(hidden)]
#[macro_export]
macro_rules! __declare_class_register_out {
// #[method(...)]
{
($builder:ident)
($($qualifiers:tt)*)
Expand All @@ -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(
Expand Down

0 comments on commit 44d2c20

Please sign in to comment.