Skip to content

Commit 29bc206

Browse files
committed
Swift 3.0
1 parent e25f40f commit 29bc206

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Object.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by John Holdsworth on 26/09/2015.
66
// Copyright © 2015 John Holdsworth. All rights reserved.
77
//
8-
// $Id: //depot/SwiftRuby/Object.swift#16 $
8+
// $Id: //depot/SwiftRuby/Object.swift#17 $
99
//
1010
// Repo: https://github.com/RubyNative/SwiftRuby
1111
//
@@ -42,10 +42,10 @@ open class ENVProxy {
4242
}
4343

4444
@_silgen_name("instanceVariablesForClass")
45-
func instanceVariablesForClass( _ cls: AnyClass, _ ivarNames: NSMutableArray ) -> [String]
45+
func instanceVariablesForClass( _ cls: AnyClass, _ ivarNames: NSMutableArray ) -> NSArray
4646

4747
@_silgen_name("methodSymbolsForClass")
48-
func methodSymbolsForClass( _ cls: AnyClass ) -> [String]
48+
func methodSymbolsForClass( _ cls: AnyClass, _ syms: NSMutableArray ) -> NSArray
4949

5050
open class RubyObject {
5151

@@ -54,11 +54,11 @@ open class RubyObject {
5454
}
5555

5656
open var instance_variables: [String] {
57-
return instanceVariablesForClass( type(of: self), NSMutableArray() )
57+
return instanceVariablesForClass( type(of: self), NSMutableArray() ).map {$0 as! String}
5858
}
5959

6060
open var methods: [String] {
61-
return methodSymbolsForClass( type(of: self) ).map { _stdlib_demangleName( String( $0 ) ) }
61+
return methodSymbolsForClass( type(of: self), NSMutableArray() ).map { _stdlib_demangleName( $0 as! String ) }
6262
}
6363

6464
}

Utilities.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by John Holdsworth on 12/10/2015.
66
// Copyright © 2015 John Holdsworth. All rights reserved.
77
//
8-
// $Id: //depot/SwiftRuby/Utilities.h#8 $
8+
// $Id: //depot/SwiftRuby/Utilities.h#9 $
99
//
1010
// Repo: https://github.com/RubyNative/SwiftRuby
1111
//
@@ -16,7 +16,7 @@
1616
#import <Foundation/Foundation.h>
1717

1818
extern NSArray<NSString *> * _Nonnull instanceVariablesForClass( Class _Nonnull cls, NSMutableArray<NSString *> * _Nonnull ivarNames );
19-
extern NSArray<NSString *> * _Nonnull methodSymbolsForClass( Class _Nonnull cls );
19+
extern NSArray<NSString *> * _Nonnull methodSymbolsForClass( Class _Nonnull cls, NSMutableArray<NSString *> * _Nonnull syms );
2020

2121
extern NSString * _Nonnull kCatchLevels;
2222

Utilities.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by John Holdsworth on 26/09/2015.
66
// Copyright © 2015 John Holdsworth. All rights reserved.
77
//
8-
// $Id: //depot/SwiftRuby/Utilities.m#18 $
8+
// $Id: //depot/SwiftRuby/Utilities.m#19 $
99
//
1010
// Repo: https://github.com/RubyNative/SwiftRuby
1111
//
@@ -30,7 +30,8 @@
3030

3131
struct _swift_data3 {
3232
// unsigned long flags;
33-
const char *className;
33+
// const char *className;
34+
int className;
3435
int fieldcount, flags2;
3536
int ivarNames;
3637
int get_field_data;
@@ -75,8 +76,7 @@
7576
return ivarNames;
7677
}
7778

78-
NSArray<NSString *> *methodSymbolsForClass( Class cls ) {
79-
NSMutableArray<NSString *> *syms = [NSMutableArray new];
79+
NSArray<NSString *> *methodSymbolsForClass( Class cls, NSMutableArray<NSString *> *syms ) {
8080

8181
struct _in_objc_class *swiftClass = (__bridge struct _in_objc_class *)cls;
8282

0 commit comments

Comments
 (0)