Skip to content

Commit

Permalink
Fix crash (and remove prince)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis committed Dec 13, 2017
1 parent 83fdd41 commit 0736d3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/UrlFormEncoding/UrlFormDecoder.swift
Expand Up @@ -238,7 +238,6 @@ public final class UrlFormDecoder: Decoder {

self.decoder.codingPath.append(key)
defer { self.decoder.codingPath.removeLast() }
print(1)
guard let container = self.container[key.stringValue] as? [String: Any] else {
throw Error.decodingError("Expected value at \(key), got nil", self.codingPath)
}
Expand All @@ -250,7 +249,6 @@ public final class UrlFormDecoder: Decoder {
func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {
self.decoder.codingPath.append(key)
defer { self.decoder.codingPath.removeLast() }
print(2)
guard let container = self.container[key.stringValue] as? [Any] else {
throw Error.decodingError("Expected value at \(key), got nil", self.codingPath)
}
Expand All @@ -266,7 +264,6 @@ public final class UrlFormDecoder: Decoder {
func superDecoder(forKey key: Key) throws -> Decoder {
self.decoder.codingPath.append(key)
defer { self.decoder.codingPath.removeLast() }
print(3)
guard let container = self.container[key.stringValue] else {
throw Error.decodingError("Expected value at \(key), got nil", self.codingPath)
}
Expand Down Expand Up @@ -395,6 +392,7 @@ public final class UrlFormDecoder: Decoder {
where NestedKey: CodingKey {

guard !self.isAtEnd else { throw Error.decodingError("Unkeyed container is at end", self.codingPath) }
self.codingPath.append(Key(index: self.currentIndex))
defer { self.codingPath.removeLast() }
guard let container = self.container[self.currentIndex] as? [String: Any] else {
throw Error.decodingError("Expected value at \(self.currentIndex), got nil", self.codingPath)
Expand All @@ -407,6 +405,7 @@ public final class UrlFormDecoder: Decoder {

mutating func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer {
guard !self.isAtEnd else { throw Error.decodingError("Unkeyed container is at end", self.codingPath) }
self.codingPath.append(Key(index: self.currentIndex))
defer { self.codingPath.removeLast() }
guard let container = self.container[self.currentIndex] as? [Any] else {
throw Error.decodingError("Expected value at \(self.currentIndex), got nil", self.codingPath)
Expand All @@ -419,6 +418,7 @@ public final class UrlFormDecoder: Decoder {

mutating func superDecoder() throws -> Decoder {
guard !self.isAtEnd else { throw Error.decodingError("Unkeyed container is at end", self.codingPath) }
self.codingPath.append(Key(index: self.currentIndex))
defer { self.codingPath.removeLast() }
let container = self.container[self.currentIndex]
self.currentIndex += 1
Expand Down
1 change: 1 addition & 0 deletions Tests/LinuxMain.swift
Expand Up @@ -194,6 +194,7 @@ extension SyntaxRouterTests {
}
extension UrlFormDecoderTests {
static var allTests: [(String, (UrlFormDecoderTests) -> () throws -> Void)] = [
("testOptionality", testOptionality),
("testDefaultStrategyAccumulatePairs", testDefaultStrategyAccumulatePairs),
("testBrackets", testBrackets),
("testBracketsWithIndices", testBracketsWithIndices),
Expand Down

0 comments on commit 0736d3c

Please sign in to comment.