File tree 4 files changed +18
-23
lines changed
4 files changed +18
-23
lines changed Original file line number Diff line number Diff line change @@ -236,13 +236,21 @@ impl ObjCMethod {
236
236
) ;
237
237
}
238
238
239
+ // Get arguments without type signatures to pass to `msg_send!`
240
+ let mut args_without_types = vec ! [ ] ;
241
+ for arg in args. iter ( ) {
242
+ let name_and_sig: Vec < & str > = arg. as_str ( ) . split ( ' ' ) . collect ( ) ;
243
+ let name = name_and_sig[ 0 ] ;
244
+ args_without_types. push ( quote:: Ident :: new ( name) )
245
+ } ;
246
+
239
247
let args = split_name
240
248
. into_iter ( )
241
- . zip ( args . iter ( ) )
242
- . map ( |( arg, ty ) | quote ! { #arg : #ty } ) ;
249
+ . zip ( args_without_types )
250
+ . map ( |( arg, arg_val ) | quote ! { #arg : #arg_val } ) ;
243
251
244
252
quote ! {
245
- #( #args ) , *
253
+ #( #args ) *
246
254
}
247
255
}
248
256
}
Original file line number Diff line number Diff line change @@ -30,13 +30,13 @@ impl Foo for id {
30
30
unsafe fn methodWithInt_ ( foo : :: std:: os:: raw:: c_int ) {
31
31
msg_send ! (
32
32
objc:: runtime:: Class :: get( "Foo" ) . expect( "Couldn't find Foo" ) ,
33
- methodWithInt: foo: :: std :: os :: raw :: c_int
33
+ methodWithInt: foo
34
34
)
35
35
}
36
36
unsafe fn methodWithFoo_ ( foo : id ) {
37
37
msg_send ! (
38
38
objc:: runtime:: Class :: get( "Foo" ) . expect( "Couldn't find Foo" ) ,
39
- methodWithFoo: foo: id
39
+ methodWithFoo: foo
40
40
)
41
41
}
42
42
unsafe fn methodReturningInt ( ) -> :: std:: os:: raw:: c_int {
@@ -56,11 +56,6 @@ impl Foo for id {
56
56
ptr : * mut :: std:: os:: raw:: c_char ,
57
57
floatvalue : f32 ,
58
58
) {
59
- msg_send ! (
60
- objc:: runtime:: Class :: get( "Foo" ) . expect( "Couldn't find Foo" ) ,
61
- methodWithArg1: intvalue: :: std:: os:: raw:: c_int,
62
- andArg2: ptr: * mut :: std:: os:: raw:: c_char,
63
- andArg3: floatvalue: f32
64
- )
59
+ msg_send ! ( objc :: runtime :: Class :: get ( "Foo" ) . expect ( "Couldn't find Foo" ) , methodWithArg1 : intvalue andArg2 : ptr andArg3 : floatvalue )
65
60
}
66
61
}
Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ impl Foo for id {
26
26
msg_send ! ( self , method)
27
27
}
28
28
unsafe fn methodWithInt_ ( self , foo : :: std:: os:: raw:: c_int ) {
29
- msg_send ! ( self , methodWithInt: foo: :: std :: os :: raw :: c_int )
29
+ msg_send ! ( self , methodWithInt: foo)
30
30
}
31
31
unsafe fn methodWithFoo_ ( self , foo : id ) {
32
- msg_send ! ( self , methodWithFoo: foo: id )
32
+ msg_send ! ( self , methodWithFoo: foo)
33
33
}
34
34
unsafe fn methodReturningInt ( self ) -> :: std:: os:: raw:: c_int {
35
35
msg_send ! ( self , methodReturningInt)
@@ -43,11 +43,6 @@ impl Foo for id {
43
43
ptr : * mut :: std:: os:: raw:: c_char ,
44
44
floatvalue : f32 ,
45
45
) {
46
- msg_send ! (
47
- self ,
48
- methodWithArg1: intvalue: :: std:: os:: raw:: c_int,
49
- andArg2: ptr: * mut :: std:: os:: raw:: c_char,
50
- andArg3: floatvalue: f32
51
- )
46
+ msg_send ! ( self , methodWithArg1 : intvalue andArg2 : ptr andArg3 : floatvalue )
52
47
}
53
48
}
Original file line number Diff line number Diff line change @@ -23,9 +23,6 @@ impl Foo for id {
23
23
self ,
24
24
func : :: std:: option:: Option < unsafe extern "C" fn ( ) -> :: std:: os:: raw:: c_int > ,
25
25
) {
26
- msg_send ! (
27
- self ,
28
- setFunc: func: :: std:: option:: Option <unsafe extern "C" fn ( ) -> :: std:: os:: raw:: c_int>
29
- )
26
+ msg_send ! ( self , setFunc: func)
30
27
}
31
28
}
You can’t perform that action at this time.
0 commit comments