[bugfix] fix OrderedTable iterators (#11562)

This commit is contained in:
Miran 2019-06-23 07:28:45 +02:00 • committed by Varriount
commit 3d50f7e2a1

View file

@ -1253,10 +1253,12 @@ proc enlarge[A, B](t: var OrderedTable[A, B]) =
h = nxt h = nxt
template forAllOrderedPairs(yieldStmt: untyped) {.dirty.} = template forAllOrderedPairs(yieldStmt: untyped) {.dirty.} =
if t.counter > 0:
var h = t.first var h = t.first
while h >= 0: while h >= 0:
var nxt = t.data[h].next var nxt = t.data[h].next
if isFilled(t.data[h].hcode): yieldStmt if isFilled(t.data[h].hcode):
yieldStmt
h = nxt h = nxt
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------