@@ -98,10 +98,10 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
98
98
/// then calling `next()` on this view's iterator will produce 3 ranges before returning nil.
99
99
public struct RangeView : Equatable , BidirectionalCollection {
100
100
public typealias Index = Int
101
- public let startIndex : Index
102
- public let endIndex : Index
101
+ public let startIndex : Index
102
+ public let endIndex : Index
103
103
104
- fileprivate var indexSet : IndexSet
104
+ fileprivate var indexSet : IndexSet
105
105
106
106
// Range of element values
107
107
private var intersectingRange : Range < IndexSet . Element > ?
@@ -170,10 +170,10 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
170
170
171
171
/// The mechanism for accessing the integers stored in an IndexSet.
172
172
public struct Index : CustomStringConvertible , Comparable {
173
- fileprivate var value : IndexSet . Element
174
- fileprivate var extent : Range < IndexSet . Element >
175
- fileprivate var rangeIndex : Int
176
- fileprivate let rangeCount : Int
173
+ fileprivate var value : IndexSet . Element
174
+ fileprivate var extent : Range < IndexSet . Element >
175
+ fileprivate var rangeIndex : Int
176
+ fileprivate let rangeCount : Int
177
177
178
178
fileprivate init ( value: Int , extent: Range < Int > , rangeIndex: Int , rangeCount: Int ) {
179
179
self . value = value
@@ -214,7 +214,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
214
214
_handle = _MutablePairHandle ( NSIndexSet ( ) , copying: false )
215
215
}
216
216
217
- public var hashValue : Int {
217
+ public var hashValue : Int {
218
218
return _handle. map { $0. hash }
219
219
}
220
220
@@ -230,7 +230,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
230
230
/// Returns a `Range`-based view of the entire contents of `self`.
231
231
///
232
232
/// - seealso: rangeView(of:)
233
- public var rangeView : RangeView {
233
+ public var rangeView : RangeView {
234
234
return RangeView ( indexSet: self , intersecting: nil )
235
235
}
236
236
@@ -268,8 +268,8 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
268
268
269
269
private func _range( at index: RangeView . Index ) -> Range < Element > {
270
270
return _handle. map {
271
- var location : UInt = 0
272
- var length : UInt = 0
271
+ var location : UInt = 0
272
+ var length : UInt = 0
273
273
__NSIndexSetRangeAtIndex ( $0, UInt ( index) , & location, & length)
274
274
return Int ( location) ..< Int ( location) + Int( length)
275
275
}
@@ -290,8 +290,8 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
290
290
public var endIndex : Index {
291
291
let rangeCount = _rangeCount
292
292
let rangeIndex = rangeCount - 1
293
- let extent : Range < Int >
294
- let value : Int
293
+ let extent : Range < Int >
294
+ let value : Int
295
295
if rangeCount > 0 {
296
296
extent = _range ( at: rangeCount - 1 )
297
297
value = extent. upperBound // "1 past the end" position is the last range, 1 + the end of that range's extent
@@ -683,7 +683,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
683
683
public func filteredIndexSet( in range : Range < Element > , includeInteger: ( Element ) throws -> Bool ) rethrows -> IndexSet {
684
684
let r : NSRange = _toNSRange ( range)
685
685
return try _handle. map {
686
- var error : Error ?
686
+ var error : Error ?
687
687
let result = $0. indexes ( in: r, options: [ ] , passingTest: { ( i, stop) -> Bool in
688
688
do {
689
689
let include = try includeInteger ( i)
@@ -794,14 +794,14 @@ extension IndexSet : CustomStringConvertible, CustomDebugStringConvertible, Cust
794
794
private struct IndexSetBoundaryIterator : IteratorProtocol {
795
795
typealias Element = IndexSet . Element
796
796
797
- private var i1 : IndexSet . RangeView . Iterator
798
- private var i2 : IndexSet . RangeView . Iterator
799
- private var i1Range : CountableRange < Element > ?
800
- private var i2Range : CountableRange < Element > ?
801
- private var i1UsedLower : Bool
802
- private var i2UsedLower : Bool
797
+ private var i1 : IndexSet . RangeView . Iterator
798
+ private var i2 : IndexSet . RangeView . Iterator
799
+ private var i1Range : CountableRange < Element > ?
800
+ private var i2Range : CountableRange < Element > ?
801
+ private var i1UsedLower : Bool
802
+ private var i2UsedLower : Bool
803
803
804
- fileprivate init ( _ is1 : IndexSet , _ is2 : IndexSet ) {
804
+ fileprivate init ( _ is1: IndexSet , _ is2: IndexSet ) {
805
805
i1 = is1. rangeView. makeIterator ( )
806
806
i2 = is2. rangeView. makeIterator ( )
807
807
@@ -818,21 +818,21 @@ private struct IndexSetBoundaryIterator : IteratorProtocol {
818
818
return nil
819
819
}
820
820
821
- let nextIn1 : Element
821
+ let nextIn1 : Element
822
822
if let r = i1Range {
823
823
nextIn1 = i1UsedLower ? r. upperBound : r. lowerBound
824
824
} else {
825
825
nextIn1 = Int . max
826
826
}
827
827
828
- let nextIn2 : Element
828
+ let nextIn2 : Element
829
829
if let r = i2Range {
830
830
nextIn2 = i2UsedLower ? r. upperBound : r. lowerBound
831
831
} else {
832
832
nextIn2 = Int . max
833
833
}
834
834
835
- var result : Element
835
+ var result : Element
836
836
if nextIn1 <= nextIn2 {
837
837
// 1 has the next element, or they are the same.
838
838
result = nextIn1
@@ -860,7 +860,7 @@ extension IndexSet {
860
860
}
861
861
}
862
862
863
- private func _toNSRange( _ r : Range < IndexSet . Element > ) -> NSRange {
863
+ private func _toNSRange( _ r: Range < IndexSet . Element > ) -> NSRange {
864
864
return NSMakeRange ( r. lowerBound, r. upperBound - r. lowerBound)
865
865
}
866
866
@@ -928,7 +928,7 @@ private final class _MutablePairHandle<ImmutableType : NSObject, MutableType : N
928
928
///
929
929
/// - parameter immutable: The thing to stash.
930
930
/// - parameter copying: Should be true unless you just created the instance (or called copy) and want to transfer ownership to this handle.
931
- init ( _ immutable : ImmutableType , copying : Bool = true ) {
931
+ init ( _ immutable: ImmutableType , copying: Bool = true ) {
932
932
if copying {
933
933
self . _pointer = _MutablePair. Default ( immutable. copy ( ) as! ImmutableType )
934
934
} else {
@@ -940,7 +940,7 @@ private final class _MutablePairHandle<ImmutableType : NSObject, MutableType : N
940
940
///
941
941
/// - parameter mutable: The thing to stash.
942
942
/// - parameter copying: Should be true unless you just created the instance (or called copy) and want to transfer ownership to this handle.
943
- init ( _ mutable : MutableType , copying : Bool = true ) {
943
+ init ( _ mutable: MutableType , copying: Bool = true ) {
944
944
if copying {
945
945
self . _pointer = _MutablePair. Mutable ( mutable. mutableCopy ( ) as! MutableType )
946
946
} else {
@@ -950,7 +950,7 @@ private final class _MutablePairHandle<ImmutableType : NSObject, MutableType : N
950
950
951
951
/// Apply a closure to the reference type, regardless if it is mutable or immutable.
952
952
@inline ( __always)
953
- func map< ReturnType> ( _ whatToDo : ( ImmutableType ) throws -> ReturnType ) rethrows -> ReturnType {
953
+ func map< ReturnType> ( _ whatToDo: ( ImmutableType ) throws -> ReturnType ) rethrows -> ReturnType {
954
954
switch _pointer {
955
955
case . Default( let i) :
956
956
return try whatToDo ( i)
@@ -960,7 +960,7 @@ private final class _MutablePairHandle<ImmutableType : NSObject, MutableType : N
960
960
}
961
961
}
962
962
963
- var reference : ImmutableType {
963
+ var reference : ImmutableType {
964
964
switch _pointer {
965
965
case . Default( let i) :
966
966
return i
0 commit comments