Skip to content

Commit

Permalink
small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Apr 23, 2024
1 parent b8af239 commit e63446f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/jsonpak/private/rawops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ proc rawTest*(a, b: JsonTree, na, nb: NodePos): bool =
of opcodeInt, opcodeFloat, opcodeString:
return a.atoms[LitId a.nodes[na.int].operand] == b.atoms[LitId b.nodes[nb.int].operand]
of opcodeArray:
if span(a, na.int) != span(b, nb.int):
return false
let lenA = len(a, na)
let lenB = len(b, nb)
if lenA != lenB:
if lenA != len(b, nb):
return false
var posA = na.int+1
var posB = nb.int+1
Expand All @@ -161,9 +162,9 @@ proc rawTest*(a, b: JsonTree, na, nb: NodePos): bool =
b.nextChild(posB)
return true
of opcodeObject:
let lenA = len(a, na)
let lenB = len(b, nb)
if lenA != lenB:
if span(a, na.int) != span(b, nb.int):
return false
if len(a, na) != len(b, nb):
return false
for keyA in keys(a, na):
let valA = keyA.firstSon
Expand Down

0 comments on commit e63446f

Please sign in to comment.