File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -1064,12 +1064,13 @@ when defined(nimFixedForwardGeneric):
10641064 dst = jsonNode.copy
10651065
10661066 proc initFromJson [T: SomeInteger ](dst: var T; jsonNode: JsonNode , jsonPath: var string ) =
1067- when T is uint | uint64 :
1067+ when T is uint | uint64 or (not defined (js) and int .sizeof == 4 ):
1068+ verifyJsonKind (jsonNode, {JInt , JString }, jsonPath)
10681069 case jsonNode.kind
10691070 of JString :
1070- dst = T (parseBiggestUInt (jsonNode.str))
1071+ let x = parseBiggestUInt (jsonNode.str)
1072+ dst = cast [T](x)
10711073 else :
1072- verifyJsonKind (jsonNode, {JInt }, jsonPath)
10731074 dst = T (jsonNode.num)
10741075 else :
10751076 verifyJsonKind (jsonNode, {JInt }, jsonPath)
Original file line number Diff line number Diff line change @@ -72,16 +72,16 @@ template fn() =
7272 block :
7373 let a = (int32 .high, uint32 .high)
7474 testRoundtrip (a): " [2147483647,4294967295]"
75- when not defined (js) :
75+ when int .sizeof > 4 :
7676 block :
7777 let a = (int64 .high, uint64 .high)
7878 testRoundtrip (a): " [9223372036854775807,18446744073709551615]"
79- block :
80- let a = (int .high, uint .high)
81- when int .sizeof == 4 :
82- testRoundtrip (a): " [2147483647,4294967295]"
83- else :
84- testRoundtrip (a): " [9223372036854775807,18446744073709551615]"
79+ block :
80+ let a = (int .high, uint .high)
81+ when int .sizeof == 4 :
82+ testRoundtrip (a): " [2147483647,4294967295]"
83+ else :
84+ testRoundtrip (a): " [9223372036854775807,18446744073709551615]"
8585
8686 block : # case object
8787 type Foo = object
You can’t perform that action at this time.
0 commit comments