Skip to content

Commit 192461d

Browse files
committed
Fix decodeNil behavior #20
1 parent 12e0c6e commit 192461d

File tree

1 file changed

+2
-64
lines changed

1 file changed

+2
-64
lines changed

sources/declarative/decodable/containers/UnkeyedDecodingContainer.swift

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ extension ShadowDecoder.UnkeyedContainer {
106106
}
107107

108108
mutating func decodeNil() throws -> Bool {
109-
let result = try self._fieldContainer().decodeNil()
109+
guard try self._fieldContainer().decodeNil() else { return false }
110110
self.currentIndex += 1
111-
return result
111+
return true
112112
}
113113

114114
mutating func decode(_ type: Bool.Type) throws -> Bool {
@@ -211,68 +211,6 @@ extension ShadowDecoder.UnkeyedContainer {
211211
}
212212
}
213213

214-
//extension ShadowDecoder.UnkeyedContainer {
215-
// mutating func decodeIfPresent(_ type: String.Type) throws -> String? {
216-
// try? self.decode(String.self)
217-
// }
218-
//
219-
// mutating func decodeIfPresent(_ type: Bool.Type) throws -> Bool? {
220-
// try? self.decode(Bool.self)
221-
// }
222-
//
223-
// mutating func decodeIfPresent(_ type: Int.Type) throws -> Int? {
224-
// try? self.decode(Int.self)
225-
// }
226-
//
227-
// mutating func decodeIfPresent(_ type: Int8.Type) throws -> Int8? {
228-
// try? self.decode(Int8.self)
229-
// }
230-
//
231-
// mutating func decodeIfPresent(_ type: Int16.Type) throws -> Int16? {
232-
// try? self.decode(Int16.self)
233-
// }
234-
//
235-
// mutating func decodeIfPresent(_ type: Int32.Type) throws -> Int32? {
236-
// try? self.decode(Int32.self)
237-
// }
238-
//
239-
// mutating func decodeIfPresent(_ type: Int64.Type) throws -> Int64? {
240-
// try? self.decode(Int64.self)
241-
// }
242-
//
243-
// mutating func decodeIfPresent(_ type: UInt.Type) throws -> UInt? {
244-
// try? self.decode(UInt.self)
245-
// }
246-
//
247-
// mutating func decodeIfPresent(_ type: UInt8.Type) throws -> UInt8? {
248-
// try? self.decode(UInt8.self)
249-
// }
250-
//
251-
// mutating func decodeIfPresent(_ type: UInt16.Type) throws -> UInt16? {
252-
// try? self.decode(UInt16.self)
253-
// }
254-
//
255-
// mutating func decodeIfPresent(_ type: UInt32.Type) throws -> UInt32? {
256-
// try? self.decode(UInt32.self)
257-
// }
258-
//
259-
// mutating func decodeIfPresent(_ type: UInt64.Type) throws -> UInt64? {
260-
// try? self.decode(UInt64.self)
261-
// }
262-
//
263-
// mutating func decodeIfPresent(_ type: Float.Type) throws -> Float? {
264-
// try? self.decode(Float.self)
265-
// }
266-
//
267-
// mutating func decodeIfPresent(_ type: Double.Type) throws -> Double? {
268-
// try? self.decode(Double.self)
269-
// }
270-
//
271-
// mutating func decodeIfPresent<T>(_ type: T.Type) throws -> T? where T:Decodable {
272-
// try? self.decode(T.self)
273-
// }
274-
//}
275-
276214
// MARK: -
277215

278216
private extension ShadowDecoder.UnkeyedContainer {

0 commit comments

Comments
 (0)