File tree Expand file tree Collapse file tree 9 files changed +89
-242
lines changed Expand file tree Collapse file tree 9 files changed +89
-242
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ public struct Character :
183
183
}
184
184
else {
185
185
if let native = s. _core. nativeBuffer,
186
- native. start == s. _core. _baseAddress! {
186
+ native. start == s. _core. _baseAddress {
187
187
_representation = . large( native. _storage)
188
188
return
189
189
}
Original file line number Diff line number Diff line change @@ -399,7 +399,6 @@ extension String : _ExpressibleByBuiltinUTF16StringLiteral {
399
399
baseAddress: UnsafeMutableRawPointer ( start) ,
400
400
count: Int ( utf16CodeUnitCount) ,
401
401
elementShift: 1 ,
402
- hasCocoaBuffer: false ,
403
402
owner: nil ) )
404
403
}
405
404
}
@@ -417,7 +416,6 @@ extension String : _ExpressibleByBuiltinStringLiteral {
417
416
baseAddress: UnsafeMutableRawPointer ( start) ,
418
417
count: Int ( utf8CodeUnitCount) ,
419
418
elementShift: 0 ,
420
- hasCocoaBuffer: false ,
421
419
owner: nil ) )
422
420
}
423
421
else {
@@ -753,7 +751,7 @@ extension String {
753
751
}
754
752
755
753
#if _runtime(_ObjC)
756
- return _cocoaStringToSwiftString_NonASCII (
754
+ return String ( _cocoaString :
757
755
_stdlib_NSStringLowercaseString ( self . _bridgeToObjectiveCImpl ( ) ) )
758
756
#else
759
757
return _nativeUnicodeLowercaseString ( self )
@@ -792,7 +790,7 @@ extension String {
792
790
}
793
791
794
792
#if _runtime(_ObjC)
795
- return _cocoaStringToSwiftString_NonASCII (
793
+ return String ( _cocoaString :
796
794
_stdlib_NSStringUppercaseString ( self . _bridgeToObjectiveCImpl ( ) ) )
797
795
#else
798
796
return _nativeUnicodeUppercaseString ( self )
Original file line number Diff line number Diff line change @@ -77,9 +77,6 @@ public class _SwiftNativeNSString {}
77
77
/// An `NSString` built around a slice of contiguous Swift `String` storage.
78
78
public final class _NSContiguousString : _SwiftNativeNSString , _NSStringCore {
79
79
public init ( _ _core: _StringCore ) {
80
- _sanityCheck (
81
- _core. hasContiguousStorage,
82
- " _NSContiguousString requires contiguous storage " )
83
80
self . _core = _core
84
81
super. init ( )
85
82
}
@@ -183,11 +180,6 @@ extension String {
183
180
/// Same as `_bridgeToObjectiveC()`, but located inside the core standard
184
181
/// library.
185
182
public func _stdlib_binary_bridgeToObjectiveCImpl( ) -> AnyObject {
186
- if let ns = _core. cocoaBuffer,
187
- _swift_stdlib_CFStringGetLength ( ns) == _core. count {
188
- return ns
189
- }
190
- _sanityCheck ( _core. hasContiguousStorage)
191
183
return _NSContiguousString ( _core)
192
184
}
193
185
Original file line number Diff line number Diff line change
1
+
1
2
//===----------------------------------------------------------------------===//
2
3
//
3
4
// This source file is part of the Swift.org open source project
@@ -73,17 +74,13 @@ extension String {
73
74
// Note: this operation should be consistent with equality comparison of
74
75
// Character.
75
76
#if _runtime(_ObjC)
76
- if self . _core. hasContiguousStorage && rhs. _core. hasContiguousStorage {
77
- let lhsStr = _NSContiguousString ( self . _core)
78
- let rhsStr = _NSContiguousString ( rhs. _core)
79
- let res = lhsStr. _unsafeWithNotEscapedSelfPointerPair ( rhsStr) {
80
- return Int (
81
- _stdlib_compareNSStringDeterministicUnicodeCollationPointer ( $0, $1) )
82
- }
83
- return res
77
+ let lhsStr = _NSContiguousString ( self . _core)
78
+ let rhsStr = _NSContiguousString ( rhs. _core)
79
+ let res = lhsStr. _unsafeWithNotEscapedSelfPointerPair ( rhsStr) {
80
+ return Int (
81
+ _stdlib_compareNSStringDeterministicUnicodeCollationPointer ( $0, $1) )
84
82
}
85
- return Int ( _stdlib_compareNSStringDeterministicUnicodeCollation (
86
- _bridgeToObjectiveCImpl ( ) , rhs. _bridgeToObjectiveCImpl ( ) ) )
83
+ return res
87
84
#else
88
85
switch ( _core. isASCII, rhs. _core. isASCII) {
89
86
case ( true , false ) :
You can’t perform that action at this time.
0 commit comments