@@ -6,6 +6,21 @@ use std::mem;
6
6
use runtime:: { Class , Imp , Object , Sel } ;
7
7
use { Encode , EncodeArguments } ;
8
8
9
+ #[ cfg( feature = "exception" ) ]
10
+ macro_rules! objc_try {
11
+ ( $b: block) => (
12
+ $crate:: exception:: try( || $b) . map_err( |exception| match exception {
13
+ Some ( exception) => MessageError ( format!( "Uncaught exception {:?}" , & * exception) ) ,
14
+ None => MessageError ( "Uncaught exception nil" . to_owned( ) ) ,
15
+ } )
16
+ )
17
+ }
18
+
19
+ #[ cfg( not( feature = "exception" ) ) ]
20
+ macro_rules! objc_try {
21
+ ( $b: block) => ( Ok ( $b) )
22
+ }
23
+
9
24
mod verify;
10
25
11
26
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -15,7 +30,7 @@ mod platform;
15
30
#[ path = "gnustep.rs" ]
16
31
mod platform;
17
32
18
- use self :: platform:: { msg_send_fn , msg_send_super_fn } ;
33
+ use self :: platform:: { send_unverified , send_super_unverified } ;
19
34
use self :: verify:: verify_message_signature;
20
35
21
36
/// Specifies the superclass of an instance.
@@ -151,30 +166,6 @@ impl Error for MessageError {
151
166
}
152
167
}
153
168
154
- #[ cfg( feature = "exception" ) ]
155
- macro_rules! objc_try {
156
- ( $b: block) => (
157
- $crate:: exception:: try( || $b) . map_err( |exception| match exception {
158
- Some ( exception) => MessageError ( format!( "Uncaught exception {:?}" , & * exception) ) ,
159
- None => MessageError ( "Uncaught exception nil" . to_owned( ) ) ,
160
- } )
161
- )
162
- }
163
-
164
- #[ cfg( not( feature = "exception" ) ) ]
165
- macro_rules! objc_try {
166
- ( $b: block) => ( Ok ( $b) )
167
- }
168
-
169
- unsafe fn send_unverified < T , A , R > ( obj : * const T , sel : Sel , args : A )
170
- -> Result < R , MessageError >
171
- where T : Message , A : MessageArguments , R : Any {
172
- let ( msg_send_fn, receiver) = msg_send_fn :: < R > ( obj as * mut T as * mut Object , sel) ;
173
- objc_try ! ( {
174
- A :: invoke( msg_send_fn, receiver, sel, args)
175
- } )
176
- }
177
-
178
169
#[ doc( hidden) ]
179
170
#[ inline( always) ]
180
171
#[ cfg( not( feature = "verify_message" ) ) ]
@@ -202,16 +193,6 @@ pub unsafe fn send_message<T, A, R>(obj: *const T, sel: Sel, args: A)
202
193
} )
203
194
}
204
195
205
- unsafe fn send_super_unverified < T , A , R > ( obj : * const T , superclass : & Class ,
206
- sel : Sel , args : A ) -> Result < R , MessageError >
207
- where T : Message , A : MessageArguments , R : Any {
208
- let sup = Super { receiver : obj as * mut T as * mut Object , superclass : superclass } ;
209
- let ( msg_send_fn, receiver) = msg_send_super_fn :: < R > ( & sup, sel) ;
210
- objc_try ! ( {
211
- A :: invoke( msg_send_fn, receiver, sel, args)
212
- } )
213
- }
214
-
215
196
#[ doc( hidden) ]
216
197
#[ inline( always) ]
217
198
#[ cfg( not( feature = "verify_message" ) ) ]
0 commit comments