Skip to content

Commit dd5406f

Browse files
committed
Convert the Dispatch and Foundation overlays to 'fileprivate'.
Similar to the work in #445. Groundwork for SE-0025 ('private' and 'fileprivate'). No intended functionality change.
1 parent 88d227e commit dd5406f

16 files changed

+40
-40
lines changed

Darwin/Foundation-swiftoverlay/Boxing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
///
1717
/// Note: This assumes that the result of calling copy() is mutable. The documentation says that classes which do not have a mutable/immutable distinction should just adopt NSCopying instead of NSMutableCopying.
1818
internal final class _MutableHandle<MutableType : NSObject where MutableType : NSCopying> {
19-
private var _pointer : MutableType
19+
fileprivate var _pointer : MutableType
2020

2121
init(reference : MutableType) {
2222
_pointer = reference.copy() as! MutableType

Darwin/Foundation-swiftoverlay/Calendar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public struct Calendar : CustomStringConvertible, CustomDebugStringConvertible,
115115
// MARK: -
116116
// MARK: Bridging
117117

118-
private init(reference : NSCalendar) {
118+
fileprivate init(reference : NSCalendar) {
119119
_handle = _MutableHandle(reference: reference)
120120
if __NSCalendarIsAutoupdating(reference) {
121121
_autoupdating = true

Darwin/Foundation-swiftoverlay/CharacterSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public struct CharacterSet : ReferenceConvertible, Equatable, Hashable, SetAlgeb
8282

8383
// MARK: Init methods
8484

85-
private init(_bridged characterSet: NSCharacterSet) {
85+
fileprivate init(_bridged characterSet: NSCharacterSet) {
8686
// We must copy the input because it might be mutable; just like storing a value type in ObjC
8787
_wrapped = _SwiftNSCharacterSet(immutableObject: characterSet.copy() as AnyObject)
8888
}

Darwin/Foundation-swiftoverlay/Data.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
103103
/// A custom deallocator.
104104
case custom((UnsafeMutablePointer<UInt8>, Int) -> Void)
105105

106-
private var _deallocator : ((UnsafeMutablePointer<Void>, Int) -> Void)? {
106+
fileprivate var _deallocator : ((UnsafeMutablePointer<Void>, Int) -> Void)? {
107107
switch self {
108108
case .virtualMemory:
109109
return { __NSDataInvokeDeallocatorVM($0, $1) }

Darwin/Foundation-swiftoverlay/Date.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import CoreFoundation
2121
public struct Date : ReferenceConvertible, Comparable, Equatable, CustomStringConvertible {
2222
public typealias ReferenceType = NSDate
2323

24-
private var _time : TimeInterval
24+
fileprivate var _time : TimeInterval
2525

2626
/// The number of seconds from 1 January 1970 to the reference date, 1 January 2001.
2727
public static let timeIntervalBetween1970AndReferenceDate : TimeInterval = 978307200.0

Darwin/Foundation-swiftoverlay/DateComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public struct DateComponents : ReferenceConvertible, Hashable, Equatable, _Mutab
277277

278278
// MARK: - Bridging Helpers
279279

280-
private init(reference: NSDateComponents) {
280+
fileprivate init(reference: NSDateComponents) {
281281
_handle = _MutableHandle(reference: reference)
282282
}
283283

Darwin/Foundation-swiftoverlay/IndexPath.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
156156

157157
// MARK: - Bridging Helpers
158158

159-
private init(nsIndexPath: ReferenceType) {
159+
fileprivate init(nsIndexPath: ReferenceType) {
160160
let count = nsIndexPath.length
161161
if count == 0 {
162162
_indexes = []
@@ -171,7 +171,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
171171
}
172172
}
173173

174-
private func makeReference() -> ReferenceType {
174+
fileprivate func makeReference() -> ReferenceType {
175175
return _indexes.withUnsafeBufferPointer {
176176
return ReferenceType(indexes: $0.baseAddress, length: $0.count)
177177
}

Darwin/Foundation-swiftoverlay/IndexSet.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
101101
public let startIndex : Index
102102
public let endIndex : Index
103103

104-
private var indexSet : IndexSet
104+
fileprivate var indexSet : IndexSet
105105

106106
// Range of element values
107107
private var intersectingRange : Range<IndexSet.Element>?
108108

109-
private init(indexSet : IndexSet, intersecting range : Range<IndexSet.Element>?) {
109+
fileprivate init(indexSet : IndexSet, intersecting range : Range<IndexSet.Element>?) {
110110
self.indexSet = indexSet
111111
self.intersectingRange = range
112112

@@ -170,12 +170,12 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
170170

171171
/// The mechanism for accessing the integers stored in an IndexSet.
172172
public struct Index : CustomStringConvertible, Comparable {
173-
private var value : IndexSet.Element
174-
private var extent : Range<IndexSet.Element>
175-
private var rangeIndex : Int
176-
private 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
177177

178-
private init(value: Int, extent: Range<Int>, rangeIndex: Int, rangeCount: Int) {
178+
fileprivate init(value: Int, extent: Range<Int>, rangeIndex: Int, rangeCount: Int) {
179179
self.value = value
180180
self.extent = extent
181181
self.rangeCount = rangeCount
@@ -190,7 +190,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
190190
public typealias ReferenceType = NSIndexSet
191191
public typealias Element = Int
192192

193-
private var _handle: _MutablePairHandle<NSIndexSet, NSMutableIndexSet>
193+
fileprivate var _handle: _MutablePairHandle<NSIndexSet, NSMutableIndexSet>
194194

195195
/// Initialize an `IndexSet` with a range of integers.
196196
public init(integersIn range: Range<Element>) {
@@ -768,11 +768,11 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
768768

769769
// MARK: - Bridging Support
770770

771-
private var reference: NSIndexSet {
771+
fileprivate var reference: NSIndexSet {
772772
return _handle.reference
773773
}
774774

775-
private init(reference: NSIndexSet) {
775+
fileprivate init(reference: NSIndexSet) {
776776
_handle = _MutablePairHandle(reference)
777777
}
778778
}
@@ -788,7 +788,7 @@ private struct IndexSetBoundaryIterator : IteratorProtocol {
788788
private var i1UsedLower : Bool
789789
private var i2UsedLower : Bool
790790

791-
private init(_ is1 : IndexSet, _ is2 : IndexSet) {
791+
fileprivate init(_ is1 : IndexSet, _ is2 : IndexSet) {
792792
i1 = is1.rangeView.makeIterator()
793793
i2 = is2.rangeView.makeIterator()
794794

@@ -800,7 +800,7 @@ private struct IndexSetBoundaryIterator : IteratorProtocol {
800800
i2UsedLower = false
801801
}
802802

803-
private mutating func next() -> Element? {
803+
fileprivate mutating func next() -> Element? {
804804
if i1Range == nil && i2Range == nil {
805805
return nil
806806
}
@@ -900,7 +900,7 @@ private enum _MutablePair<ImmutableType, MutableType> {
900900
///
901901
/// a.k.a. Box
902902
private final class _MutablePairHandle<ImmutableType : NSObject, MutableType : NSObject where ImmutableType : NSMutableCopying, MutableType : NSMutableCopying> {
903-
private var _pointer: _MutablePair<ImmutableType, MutableType>
903+
fileprivate var _pointer: _MutablePair<ImmutableType, MutableType>
904904

905905
/// Initialize with an immutable reference instance.
906906
///

Darwin/Foundation-swiftoverlay/Locale.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public struct Locale : CustomStringConvertible, CustomDebugStringConvertible, Ha
3434

3535
public typealias LanguageDirection = NSLocale.LanguageDirection
3636

37-
private var _wrapped : NSLocale
37+
fileprivate var _wrapped : NSLocale
3838
private var _autoupdating : Bool
3939

4040
/// Returns a locale which tracks the user's current preferences.
@@ -61,7 +61,7 @@ public struct Locale : CustomStringConvertible, CustomDebugStringConvertible, Ha
6161
_autoupdating = false
6262
}
6363

64-
private init(reference: NSLocale) {
64+
fileprivate init(reference: NSLocale) {
6565
_wrapped = reference.copy() as! NSLocale
6666
if __NSLocaleIsAutoupdating(reference) {
6767
_autoupdating = true

Darwin/Foundation-swiftoverlay/PersonNameComponents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public struct PersonNameComponents : ReferenceConvertible, Hashable, Equatable,
2121
_handle = _MutableHandle(adoptingReference: NSPersonNameComponents())
2222
}
2323

24-
private init(reference: NSPersonNameComponents) {
24+
fileprivate init(reference: NSPersonNameComponents) {
2525
_handle = _MutableHandle(reference: reference)
2626
}
2727

Darwin/Foundation-swiftoverlay/TimeZone.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal func __NSTimeZoneCurrent() -> NSTimeZone
3333
public struct TimeZone : CustomStringConvertible, CustomDebugStringConvertible, Hashable, Equatable, ReferenceConvertible {
3434
public typealias ReferenceType = NSTimeZone
3535

36-
private var _wrapped : NSTimeZone
36+
fileprivate var _wrapped : NSTimeZone
3737
private var _autoupdating : Bool
3838

3939
/// The time zone currently used by the system.
@@ -100,7 +100,7 @@ public struct TimeZone : CustomStringConvertible, CustomDebugStringConvertible,
100100
}
101101
}
102102

103-
private init(reference: NSTimeZone) {
103+
fileprivate init(reference: NSTimeZone) {
104104
if __NSTimeZoneIsAutoupdating(reference) {
105105
// we can't copy this or we lose its auto-ness (27048257)
106106
// fortunately it's immutable

Darwin/Foundation-swiftoverlay/URL.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ public struct URLThumbnailSizeKey : RawRepresentable, Hashable {
3636
As a convenience, volume resource values can be requested from any file system URL. The value returned will reflect the property value for the volume on which the resource is located.
3737
*/
3838
public struct URLResourceValues {
39-
private var _values: [URLResourceKey: Any]
40-
private var _keys: Set<URLResourceKey>
39+
fileprivate var _values: [URLResourceKey: Any]
40+
fileprivate var _keys: Set<URLResourceKey>
4141

4242
public init() {
4343
_values = [:]
4444
_keys = []
4545
}
4646

47-
private init(keys: Set<URLResourceKey>, values: [URLResourceKey: Any]) {
47+
fileprivate init(keys: Set<URLResourceKey>, values: [URLResourceKey: Any]) {
4848
_values = values
4949
_keys = keys
5050
}
@@ -477,7 +477,7 @@ public struct URLResourceValues {
477477
*/
478478
public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
479479
public typealias ReferenceType = NSURL
480-
private var _url : NSURL
480+
fileprivate var _url : NSURL
481481

482482
public typealias BookmarkResolutionOptions = NSURL.BookmarkResolutionOptions
483483
public typealias BookmarkCreationOptions = NSURL.BookmarkCreationOptions
@@ -1130,7 +1130,7 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
11301130
}
11311131
}
11321132

1133-
private init(reference: NSURL) {
1133+
fileprivate init(reference: NSURL) {
11341134
_url = URL._converted(from: reference).copy() as! NSURL
11351135
}
11361136

Darwin/Foundation-swiftoverlay/URLComponents.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public struct URLComponents : ReferenceConvertible, Hashable, CustomStringConver
305305

306306
// MARK: - Bridging
307307

308-
private init(reference: NSURLComponents) {
308+
fileprivate init(reference: NSURLComponents) {
309309
_handle = _MutableHandle(reference: reference)
310310
}
311311

@@ -349,14 +349,14 @@ extension URLComponents : _ObjectiveCBridgeable {
349349
public struct URLQueryItem : ReferenceConvertible, Hashable, Equatable, CustomStringConvertible {
350350
public typealias ReferenceType = NSURLQueryItem
351351

352-
private var _queryItem : NSURLQueryItem
352+
fileprivate var _queryItem : NSURLQueryItem
353353

354354
public init(name: String, value: String?) {
355355
_queryItem = NSURLQueryItem(name: name, value: value)
356356
}
357357

358-
private init(reference: NSURLQueryItem) { _queryItem = reference.copy() as! NSURLQueryItem }
359-
private var reference : NSURLQueryItem { return _queryItem }
358+
fileprivate init(reference: NSURLQueryItem) { _queryItem = reference.copy() as! NSURLQueryItem }
359+
fileprivate var reference : NSURLQueryItem { return _queryItem }
360360

361361
public var name : String {
362362
get { return _queryItem.name }

Darwin/Foundation-swiftoverlay/URLRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct URLRequest : ReferenceConvertible, CustomStringConvertible, Equata
4141
_handle = _MutableHandle(adoptingReference: NSMutableURLRequest(url: url, cachePolicy: cachePolicy, timeoutInterval: timeoutInterval))
4242
}
4343

44-
private init(_bridged request: NSURLRequest) {
44+
fileprivate init(_bridged request: NSURLRequest) {
4545
_handle = _MutableHandle(reference: request.mutableCopy() as! NSMutableURLRequest)
4646
}
4747

Darwin/Foundation-swiftoverlay/UUID.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConv
2727
}
2828
}
2929

30-
private init(reference: NSUUID) {
30+
fileprivate init(reference: NSUUID) {
3131
var bytes: uuid_t = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
3232
withUnsafeMutablePointer(&bytes) {
3333
reference.getBytes(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self))
@@ -79,7 +79,7 @@ public struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConv
7979

8080
// MARK: - Bridging Support
8181

82-
private var reference: NSUUID {
82+
fileprivate var reference: NSUUID {
8383
var bytes = uuid
8484
return withUnsafePointer(&bytes) {
8585
return NSUUID(uuidBytes: unsafeBitCast($0, to: UnsafePointer<UInt8>.self))

Darwin/Foundation-swiftoverlay/UserInfo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ internal class _NSUserInfoDictionaryKeyEnumerator : NSEnumerator {
4646
}
4747

4848
internal class _NSUserInfoDictionary : NSMutableDictionary {
49-
private var _objc = [NSObject : AnyObject]()
50-
private var _swift = [NSObject : Any]()
49+
fileprivate var _objc = [NSObject : AnyObject]()
50+
fileprivate var _swift = [NSObject : Any]()
5151

5252
/// Note: these two init methods are the only proper method of construction and must be marked as "convenience" and call super.init() because the overlay has required init methods in extensions
5353
private convenience init(objc: [NSObject : AnyObject], swift: [NSObject : Any]) {

0 commit comments

Comments
 (0)