mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove previous hack for SR-5206
As a temporary workaround for SR-5206, certain Foundation types which had custom behavior in JSONEncoder and JSONDecoder were granted special knowledge of those types internally in order to preserve strategies on encode/decode. This replaces that special knowledge with a more general-purpose fix that works for all types and all encoders/decoders.
This commit is contained in:
@@ -99,7 +99,7 @@ open class JSONEncoder {
|
||||
open var userInfo: [CodingUserInfoKey : Any] = [:]
|
||||
|
||||
/// Options set on the top-level encoder to pass down the encoding hierarchy.
|
||||
internal struct _Options {
|
||||
fileprivate struct _Options {
|
||||
let dateEncodingStrategy: DateEncodingStrategy
|
||||
let dataEncodingStrategy: DataEncodingStrategy
|
||||
let nonConformingFloatEncodingStrategy: NonConformingFloatEncodingStrategy
|
||||
@@ -155,14 +155,14 @@ open class JSONEncoder {
|
||||
|
||||
// MARK: - _JSONEncoder
|
||||
|
||||
internal class _JSONEncoder : Encoder {
|
||||
fileprivate class _JSONEncoder : Encoder {
|
||||
// MARK: Properties
|
||||
|
||||
/// The encoder's storage.
|
||||
fileprivate var storage: _JSONEncodingStorage
|
||||
|
||||
/// Options set on the top-level encoder.
|
||||
internal let options: JSONEncoder._Options
|
||||
fileprivate let options: JSONEncoder._Options
|
||||
|
||||
/// The path to the current point in encoding.
|
||||
public var codingPath: [CodingKey]
|
||||
@@ -827,7 +827,7 @@ open class JSONDecoder {
|
||||
open var userInfo: [CodingUserInfoKey : Any] = [:]
|
||||
|
||||
/// Options set on the top-level encoder to pass down the decoding hierarchy.
|
||||
internal struct _Options {
|
||||
fileprivate struct _Options {
|
||||
let dateDecodingStrategy: DateDecodingStrategy
|
||||
let dataDecodingStrategy: DataDecodingStrategy
|
||||
let nonConformingFloatDecodingStrategy: NonConformingFloatDecodingStrategy
|
||||
@@ -871,14 +871,14 @@ open class JSONDecoder {
|
||||
|
||||
// MARK: - _JSONDecoder
|
||||
|
||||
internal class _JSONDecoder : Decoder {
|
||||
fileprivate class _JSONDecoder : Decoder {
|
||||
// MARK: Properties
|
||||
|
||||
/// The decoder's storage.
|
||||
fileprivate var storage: _JSONDecodingStorage
|
||||
|
||||
/// Options set on the top-level decoder.
|
||||
internal let options: JSONDecoder._Options
|
||||
fileprivate let options: JSONDecoder._Options
|
||||
|
||||
/// The path to the current point in encoding.
|
||||
fileprivate(set) public var codingPath: [CodingKey]
|
||||
|
||||
Reference in New Issue
Block a user