fixes another effect inference bug [backport:1.6] (#19100)
* fixes another effect inference bug [backport:1.6]
This commit is contained in:
parent
f2f15e9726
commit
fce89cb60a
7 changed files with 85 additions and 11 deletions
|
|
@ -437,7 +437,7 @@ macro `%*`*(x: untyped): untyped =
|
|||
## `%` for every element.
|
||||
result = toJsonImpl(x)
|
||||
|
||||
proc `==`*(a, b: JsonNode): bool =
|
||||
proc `==`*(a, b: JsonNode): bool {.noSideEffect.} =
|
||||
## Check two nodes for equality
|
||||
if a.isNil:
|
||||
if b.isNil: return true
|
||||
|
|
@ -464,12 +464,16 @@ proc `==`*(a, b: JsonNode): bool =
|
|||
if a.fields.len != b.fields.len: return false
|
||||
for key, val in a.fields:
|
||||
if not b.fields.hasKey(key): return false
|
||||
if b.fields[key] != val: return false
|
||||
when defined(nimHasEffectsOf):
|
||||
{.noSideEffect.}:
|
||||
if b.fields[key] != val: return false
|
||||
else:
|
||||
if b.fields[key] != val: return false
|
||||
result = true
|
||||
|
||||
proc hash*(n: OrderedTable[string, JsonNode]): Hash {.noSideEffect.}
|
||||
|
||||
proc hash*(n: JsonNode): Hash =
|
||||
proc hash*(n: JsonNode): Hash {.noSideEffect.} =
|
||||
## Compute the hash for a JSON node
|
||||
case n.kind
|
||||
of JArray:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue