@@ -23,27 +23,27 @@ internal typealias _CocoaString = AnyObject
23
23
// Foundation.
24
24
25
25
@objc private protocol _StringSelectorHolder : _NSCopying {
26
-
26
+
27
27
@objc var length : Int { get }
28
-
28
+
29
29
@objc var hash : UInt { get }
30
-
30
+
31
31
@objc ( characterAtIndex: )
32
32
func character( at offset: Int ) -> UInt16
33
-
33
+
34
34
@objc ( getCharacters: range: )
35
35
func getCharacters(
36
36
_ buffer: UnsafeMutablePointer < UInt16 > , range aRange: _SwiftNSRange
37
37
)
38
-
38
+
39
39
@objc ( _fastCStringContents: )
40
40
func _fastCStringContents(
41
41
_ requiresNulTermination: Int8
42
42
) -> UnsafePointer < CChar > ?
43
-
43
+
44
44
@objc ( _fastCharacterContents)
45
45
func _fastCharacterContents( ) -> UnsafePointer < UInt16 > ?
46
-
46
+
47
47
@objc ( getBytes: maxLength: usedLength: encoding: options: range: remainingRange: )
48
48
func getBytes( _ buffer: UnsafeMutableRawPointer ? ,
49
49
maxLength maxBufferCount: Int ,
@@ -52,25 +52,25 @@ internal typealias _CocoaString = AnyObject
52
52
options: UInt ,
53
53
range: _SwiftNSRange ,
54
54
remaining leftover: UnsafeMutablePointer < _SwiftNSRange > ? ) -> Int8
55
-
55
+
56
56
@objc ( compare: options: range: locale: )
57
57
func compare( _ string: _CocoaString ,
58
58
options: UInt ,
59
59
range: _SwiftNSRange ,
60
60
locale: AnyObject ? ) -> Int
61
61
62
62
@objc ( newTaggedNSStringWithASCIIBytes_: length_: )
63
- func createTaggedString( bytes: UnsafePointer < UInt8 > ,
63
+ func createTaggedString( bytes: UnsafePointer < UInt8 > ,
64
64
count: Int ) -> AnyObject ?
65
65
}
66
66
67
67
/*
68
68
Passing a _CocoaString through _objc() lets you call ObjC methods that the
69
69
compiler doesn't know about, via the protocol above. In order to get good
70
70
performance, you need a double indirection like this:
71
-
71
+
72
72
func a -> _objc -> func a'
73
-
73
+
74
74
because any refcounting @_effects on 'a' will be lost when _objc breaks ARC's
75
75
knowledge that the _CocoaString and _StringSelectorHolder are the same object.
76
76
*/
@@ -442,9 +442,9 @@ extension String {
442
442
@_effects ( releasenone)
443
443
public // SPI(Foundation)
444
444
func _bridgeToObjectiveCImpl( ) -> AnyObject {
445
-
445
+
446
446
_connectOrphanedFoundationSubclassesIfNeeded ( )
447
-
447
+
448
448
// Smol ASCII a) may bridge to tagged pointers, b) can't contain a BOM
449
449
if _guts. isSmallASCII {
450
450
let maybeTagged = _guts. asSmall. withUTF8 { bufPtr in
@@ -456,7 +456,7 @@ extension String {
456
456
}
457
457
if let tagged = maybeTagged { return tagged }
458
458
}
459
-
459
+
460
460
if _guts. isSmall {
461
461
// We can't form a tagged pointer String, so grow to a non-small String,
462
462
// and bridge that instead. Also avoids CF deleting any BOM that may be
0 commit comments