@@ -520,7 +520,6 @@ where Encoding.EncodedScalar == _UIntBuffer<_UInt32, Encoding.CodeUnit>,
520
520
_UInt32 == UInt32
521
521
{
522
522
associatedtype _UInt32 = UInt32
523
- static func _isScalar( _: Encoding . CodeUnit ) -> Bool
524
523
func _parseMultipleCodeUnits( ) -> ( isValid: Bool , bitCount: UInt8 )
525
524
var buffer : Encoding . EncodedScalar { get set }
526
525
func _bufferedScalar( bitCount: UInt8 ) -> Encoding . EncodedScalar
@@ -536,12 +535,12 @@ extension _UTFDecoder where Encoding.EncodedScalar == _UIntBuffer<UInt32, Encodi
536
535
if _fastPath ( buffer. isEmpty) {
537
536
guard let codeUnit = input. next ( ) else { return . emptyInput }
538
537
// ASCII, return immediately.
539
- if Self . _isScalar ( codeUnit) {
538
+ if Encoding . _isScalar ( codeUnit) {
540
539
return . valid( Encoding . EncodedScalar ( containing: codeUnit) )
541
540
}
542
541
// Non-ASCII, proceed to buffering mode.
543
542
buffer. append ( codeUnit)
544
- } else if Self . _isScalar ( Encoding . CodeUnit ( extendingOrTruncating: buffer. _storage) ) {
543
+ } else if Encoding . _isScalar ( Encoding . CodeUnit ( extendingOrTruncating: buffer. _storage) ) {
545
544
// ASCII in buffer. We don't refill the buffer so we can return
546
545
// to bufferless mode once we've exhausted it.
547
546
let codeUnit = Encoding . CodeUnit ( extendingOrTruncating: buffer. _storage)
@@ -587,13 +586,6 @@ extension _UTFDecoder where Encoding.EncodedScalar == _UIntBuffer<UInt32, Encodi
587
586
//===--- UTF8 Decoders ----------------------------------------------------===//
588
587
//===----------------------------------------------------------------------===//
589
588
590
- public protocol _UTF8Decoder : _UTFDecoder {
591
- }
592
-
593
- extension _UTF8Decoder {
594
- public static func _isScalar( _ x: Encoding . CodeUnit ) -> Bool { return x & 0x80 == 0 }
595
- }
596
-
597
589
extension Unicode . UTF8 : UnicodeEncoding {
598
590
public typealias EncodedScalar = _UIntBuffer < UInt32 , UInt8 >
599
591
@@ -640,7 +632,7 @@ extension Unicode.UTF8 : UnicodeEncoding {
640
632
}
641
633
}
642
634
643
- extension UTF8 . ReverseDecoder : _UTF8Decoder {
635
+ extension UTF8 . ReverseDecoder : _UTFDecoder {
644
636
public typealias Encoding = Unicode . UTF8
645
637
646
638
public // @testable
@@ -715,7 +707,7 @@ extension UTF8.ReverseDecoder : _UTF8Decoder {
715
707
}
716
708
717
709
extension
718
- Unicode . UTF8 . ForwardDecoder : _UTF8Decoder {
710
+ Unicode . UTF8 . ForwardDecoder : _UTFDecoder {
719
711
public typealias Encoding = Unicode . UTF8
720
712
721
713
public // @testable
@@ -786,15 +778,6 @@ extension
786
778
//===--- UTF-16 Decoders --------------------------------------------------===//
787
779
//===----------------------------------------------------------------------===//
788
780
789
- public protocol _UTF16Decoder : _UTFDecoder where Encoding. CodeUnit == UTF16 . CodeUnit {
790
- }
791
-
792
- extension _UTF16Decoder {
793
- public static func _isScalar( _ x: Encoding . CodeUnit ) -> Bool {
794
- return x & 0xf800 != 0xd800
795
- }
796
- }
797
-
798
781
extension Unicode . UTF16 : UnicodeEncoding {
799
782
public typealias EncodedScalar = _UIntBuffer < UInt32 , UInt16 >
800
783
@@ -829,7 +812,7 @@ extension Unicode.UTF16 : UnicodeEncoding {
829
812
}
830
813
}
831
814
832
- extension UTF16 . ReverseDecoder : _UTF16Decoder {
815
+ extension UTF16 . ReverseDecoder : _UTFDecoder {
833
816
public typealias Encoding = Unicode . UTF16
834
817
835
818
public // @testable
@@ -851,7 +834,7 @@ extension UTF16.ReverseDecoder : _UTF16Decoder {
851
834
}
852
835
}
853
836
854
- extension Unicode . UTF16 . ForwardDecoder : _UTF16Decoder {
837
+ extension Unicode . UTF16 . ForwardDecoder : _UTFDecoder {
855
838
public typealias Encoding = Unicode . UTF16
856
839
857
840
public // @testable
0 commit comments