Skip to content

Commit 760cae3

Browse files
committed
refactor: Optimize the code execution path
1 parent 884af3f commit 760cae3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Sources/ReerJSON/JSONDecoderImpl.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ extension JSONDecoderImpl: SingleValueDecodingContainer {
477477

478478
@inline(__always)
479479
private func decodeInteger<T: FixedWidthInteger>() throws -> T {
480-
guard topValue.isNumber else {
481-
throw createTypeMismatchError(type: T.self, for: codingPath, value: topValue)
482-
}
483480
guard let int: T = topValue.integer() else {
481+
guard topValue.isNumber else {
482+
throw createTypeMismatchError(type: T.self, for: codingPath, value: topValue)
483+
}
484484
throw DecodingError.dataCorrupted(.init(
485485
codingPath: codingPath,
486486
debugDescription: "Number \(topValue.numberValue) is not representable in Swift."

0 commit comments

Comments
 (0)