@@ -53,9 +53,9 @@ extension Dictionary : _JSONStringDictionaryDecodableMarker where Key == String,
53
53
/// `JSONEncoder` facilitates the encoding of `Encodable` values into JSON.
54
54
// NOTE: older overlays had Foundation.JSONEncoder as the ObjC name.
55
55
// The two must coexist, so it was renamed. The old name must not be
56
- // used in the new runtime. _TtC10Foundation12_JSONEncoder is the
57
- // mangled name for Foundation._JSONEncoder .
58
- @_objcRuntimeName ( _TtC10Foundation12_JSONEncoder )
56
+ // used in the new runtime. _TtC10Foundation13__JSONEncoder is the
57
+ // mangled name for Foundation.__JSONEncoder .
58
+ @_objcRuntimeName ( _TtC10Foundation13__JSONEncoder )
59
59
open class JSONEncoder {
60
60
// MARK: Options
61
61
@@ -1017,9 +1017,9 @@ fileprivate class __JSONReferencingEncoder : __JSONEncoder {
1017
1017
/// `JSONDecoder` facilitates the decoding of JSON into semantic `Decodable` types.
1018
1018
// NOTE: older overlays had Foundation.JSONDecoder as the ObjC name.
1019
1019
// The two must coexist, so it was renamed. The old name must not be
1020
- // used in the new runtime. _TtC10Foundation12_JSONDecoder is the
1021
- // mangled name for Foundation._JSONDecoder .
1022
- @_objcRuntimeName ( _TtC10Foundation12_JSONDecoder )
1020
+ // used in the new runtime. _TtC10Foundation13__JSONDecoder is the
1021
+ // mangled name for Foundation.__JSONDecoder .
1022
+ @_objcRuntimeName ( _TtC10Foundation13__JSONDecoder )
1023
1023
open class JSONDecoder {
1024
1024
// MARK: Options
1025
1025
@@ -1190,7 +1190,7 @@ open class JSONDecoder {
1190
1190
throw DecodingError . dataCorrupted ( DecodingError . Context ( codingPath: [ ] , debugDescription: " The given data was not valid JSON. " , underlyingError: error) )
1191
1191
}
1192
1192
1193
- let decoder = _JSONDecoder ( referencing: topLevel, options: self . options)
1193
+ let decoder = __JSONDecoder ( referencing: topLevel, options: self . options)
1194
1194
guard let value = try decoder. unbox ( topLevel, as: type) else {
1195
1195
throw DecodingError . valueNotFound ( type, DecodingError . Context ( codingPath: [ ] , debugDescription: " The given data did not contain a top-level value. " ) )
1196
1196
}
@@ -1199,9 +1199,12 @@ open class JSONDecoder {
1199
1199
}
1200
1200
}
1201
1201
1202
- // MARK: - _JSONDecoder
1202
+ // MARK: - __JSONDecoder
1203
1203
1204
- fileprivate class _JSONDecoder : Decoder {
1204
+ // NOTE: older overlays called this class _JSONDecoder. The two must
1205
+ // coexist without a conflicting ObjC class name, so it was renamed.
1206
+ // The old name must not be used in the new runtime.
1207
+ fileprivate class __JSONDecoder : Decoder {
1205
1208
// MARK: Properties
1206
1209
1207
1210
/// The decoder's storage.
@@ -1307,7 +1310,7 @@ fileprivate struct _JSONKeyedDecodingContainer<K : CodingKey> : KeyedDecodingCon
1307
1310
// MARK: Properties
1308
1311
1309
1312
/// A reference to the decoder we're reading from.
1310
- private let decoder : _JSONDecoder
1313
+ private let decoder : __JSONDecoder
1311
1314
1312
1315
/// A reference to the container we're reading from.
1313
1316
private let container : [ String : Any ]
@@ -1318,7 +1321,7 @@ fileprivate struct _JSONKeyedDecodingContainer<K : CodingKey> : KeyedDecodingCon
1318
1321
// MARK: - Initialization
1319
1322
1320
1323
/// Initializes `self` by referencing the given decoder and container.
1321
- fileprivate init ( referencing decoder: _JSONDecoder , wrapping container: [ String : Any ] ) {
1324
+ fileprivate init ( referencing decoder: __JSONDecoder , wrapping container: [ String : Any ] ) {
1322
1325
self . decoder = decoder
1323
1326
switch decoder. options. keyDecodingStrategy {
1324
1327
case . useDefaultKeys:
@@ -1637,7 +1640,7 @@ fileprivate struct _JSONKeyedDecodingContainer<K : CodingKey> : KeyedDecodingCon
1637
1640
defer { self . decoder. codingPath. removeLast ( ) }
1638
1641
1639
1642
let value : Any = self . container [ key. stringValue] ?? NSNull ( )
1640
- return _JSONDecoder ( referencing: value, at: self . decoder. codingPath, options: self . decoder. options)
1643
+ return __JSONDecoder ( referencing: value, at: self . decoder. codingPath, options: self . decoder. options)
1641
1644
}
1642
1645
1643
1646
public func superDecoder( ) throws -> Decoder {
@@ -1653,7 +1656,7 @@ fileprivate struct _JSONUnkeyedDecodingContainer : UnkeyedDecodingContainer {
1653
1656
// MARK: Properties
1654
1657
1655
1658
/// A reference to the decoder we're reading from.
1656
- private let decoder : _JSONDecoder
1659
+ private let decoder : __JSONDecoder
1657
1660
1658
1661
/// A reference to the container we're reading from.
1659
1662
private let container : [ Any ]
@@ -1667,7 +1670,7 @@ fileprivate struct _JSONUnkeyedDecodingContainer : UnkeyedDecodingContainer {
1667
1670
// MARK: - Initialization
1668
1671
1669
1672
/// Initializes `self` by referencing the given decoder and container.
1670
- fileprivate init ( referencing decoder: _JSONDecoder , wrapping container: [ Any ] ) {
1673
+ fileprivate init ( referencing decoder: __JSONDecoder , wrapping container: [ Any ] ) {
1671
1674
self . decoder = decoder
1672
1675
self . container = container
1673
1676
self . codingPath = decoder. codingPath
@@ -2000,11 +2003,11 @@ fileprivate struct _JSONUnkeyedDecodingContainer : UnkeyedDecodingContainer {
2000
2003
2001
2004
let value = self . container [ self . currentIndex]
2002
2005
self . currentIndex += 1
2003
- return _JSONDecoder ( referencing: value, at: self . decoder. codingPath, options: self . decoder. options)
2006
+ return __JSONDecoder ( referencing: value, at: self . decoder. codingPath, options: self . decoder. options)
2004
2007
}
2005
2008
}
2006
2009
2007
- extension _JSONDecoder : SingleValueDecodingContainer {
2010
+ extension __JSONDecoder : SingleValueDecodingContainer {
2008
2011
// MARK: SingleValueDecodingContainer Methods
2009
2012
2010
2013
private func expectNonNull< T> ( _ type: T . Type ) throws {
@@ -2095,7 +2098,7 @@ extension _JSONDecoder : SingleValueDecodingContainer {
2095
2098
2096
2099
// MARK: - Concrete Value Representations
2097
2100
2098
- extension _JSONDecoder {
2101
+ extension __JSONDecoder {
2099
2102
/// Returns the given value unboxed from a container.
2100
2103
fileprivate func unbox( _ value: Any , as type: Bool . Type ) throws -> Bool ? {
2101
2104
guard !( value is NSNull ) else { return nil }
0 commit comments