diff --git a/objc2/src/macros/__rewrite_self_arg.rs b/objc2/src/macros/__rewrite_self_arg.rs index 1684afb27..9cb5d6657 100644 --- a/objc2/src/macros/__rewrite_self_arg.rs +++ b/objc2/src/macros/__rewrite_self_arg.rs @@ -20,7 +20,7 @@ macro_rules! __rewrite_self_arg { { ($out_macro:path) @(&mut self $($__rest_args:tt)*) - @(&mut $self:ident $(, $($rest_args:tt)*)?) + @(&mut $self:ident $(, $($rest:tt)*)?) $($macro_args:tt)* } => { $out_macro! { @@ -29,14 +29,14 @@ macro_rules! __rewrite_self_arg { @( $self: &mut Self, _: $crate::runtime::Sel, - $($($rest_args)*)? ) + @($($($rest)*)?) } }; { ($out_macro:path) @(&self $($__rest_args:tt)*) - @(&$self:ident $(, $($rest_args:tt)*)?) + @(&$self:ident $(, $($rest:tt)*)?) $($macro_args:tt)* } => { $out_macro! { @@ -45,14 +45,14 @@ macro_rules! __rewrite_self_arg { @( $self: &Self, _: $crate::runtime::Sel, - $($($rest_args)*)? ) + @($($($rest)*)?) } }; { ($out_macro:path) @(mut self: $__self_ty:ty $(, $($__rest_args:tt)*)?) - @(mut $self:ident: $self_ty:ty $(, $($rest_args:tt)*)?) + @(mut $self:ident: $self_ty:ty $(, $($rest:tt)*)?) $($macro_args:tt)* } => { $out_macro! { @@ -61,14 +61,14 @@ macro_rules! __rewrite_self_arg { @( mut $self: $self_ty, _: $crate::runtime::Sel, - $($($rest_args)*)? ) + @($($($rest)*)?) } }; { ($out_macro:path) @(self: $__self_ty:ty $(, $($__rest_args:tt)*)?) - @($self:ident: $self_ty:ty $(, $($rest_args:tt)*)?) + @($self:ident: $self_ty:ty $(, $($rest:tt)*)?) $($macro_args:tt)* } => { $out_macro! { @@ -77,8 +77,8 @@ macro_rules! __rewrite_self_arg { @( $self: $self_ty, _: $crate::runtime::Sel, - $($($rest_args)*)? ) + @($($($rest)*)?) } }; @@ -95,8 +95,8 @@ macro_rules! __rewrite_self_arg { @( _: &$crate::runtime::Class, _: $crate::runtime::Sel, - $($args)* ) + @($($args)*) } }; } diff --git a/objc2/src/macros/declare_class.rs b/objc2/src/macros/declare_class.rs index 811f83fa3..33e073891 100644 --- a/objc2/src/macros/declare_class.rs +++ b/objc2/src/macros/declare_class.rs @@ -25,7 +25,8 @@ macro_rules! __inner_declare_class { @($($ret)?) @($body) // Will add @(kind) - // Will add @(args) + // Will add @(args_start) + // Will add @(args_rest) } $crate::__inner_declare_class! { @@ -54,6 +55,8 @@ macro_rules! __inner_declare_class { @($name) @($($ret)?) @($body) + + // Same as above } $crate::__inner_declare_class! { @@ -73,12 +76,13 @@ macro_rules! __inner_declare_class { @() @($($body:tt)*) @($($_kind:tt)*) - @($($args:tt)*) + @($($args_start:tt)*) + @($($args_rest:tt)*) } => { $crate::__attribute_helper! { @strip_sel $(@[$($m)*])* - ($($qualifiers)* fn $name($($args)*) { + ($($qualifiers)* fn $name($($args_start)* $($args_rest)*) { $($body)* }) } @@ -92,12 +96,13 @@ macro_rules! __inner_declare_class { @($ret:ty) @($($body:tt)*) @($($_kind:tt)*) - @($($args:tt)*) + @($($args_start:tt)*) + @($($args_rest:tt)*) } => { $crate::__attribute_helper! { @strip_sel $(@[$($m)*])* - ($($qualifiers)* fn $name($($args)*) -> <$ret as $crate::encode::EncodeConvert>::Encode { + ($($qualifiers)* fn $name($($args_start)* $($args_rest)*) -> <$ret as $crate::encode::EncodeConvert>::Encode { <$ret as $crate::encode::EncodeConvert>::into_encode($($body)*) }) } @@ -111,7 +116,8 @@ macro_rules! __inner_declare_class { @($($_ret:tt)*) @($($_body:tt)*) @(class_method) - @($($args:tt)*) + @($($args_start:tt)*) + @($($args_rest:tt)*) } => { $builder.add_class_method( $crate::__attribute_helper! { @@ -121,7 +127,7 @@ macro_rules! __inner_declare_class { @call_sel }, Self::$name as $crate::__fn_ptr! { - @($($qualifiers)*) $($args)* + @($($qualifiers)*) $($args_start)* $($args_rest)* }, ); }; @@ -133,7 +139,8 @@ macro_rules! __inner_declare_class { @($($_ret:tt)*) @($($_body:tt)*) @(instance_method) - @($($args:tt)*) + @($($args_start:tt)*) + @($($args_rest:tt)*) } => { $builder.add_method( $crate::__attribute_helper! { @@ -143,7 +150,7 @@ macro_rules! __inner_declare_class { @call_sel }, Self::$name as $crate::__fn_ptr! { - @($($qualifiers)*) $($args)* + @($($qualifiers)*) $($args_start)* $($args_rest)* }, ); };