diff options
-rw-r--r-- | compiler/treetab.nim | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/treetab.nim b/compiler/treetab.nim index 7773b68e1..26afd102c 100644 --- a/compiler/treetab.nim +++ b/compiler/treetab.nim @@ -86,12 +86,11 @@ proc nodeTablePut*(t: var TNodeTable, key: PNode, val: int) = t.data[index].val = val else: if mustRehash(t.data.len, t.counter): - var n: TNodePairSeq - newSeq(n, t.data.len * GrowthFactor) + var n = newSeq[TNodePair](t.data.len * GrowthFactor) for i in 0..high(t.data): if t.data[i].key != nil: nodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) - swap(t.data, n) + t.data = move n nodeTableRawInsert(t.data, k, key, val) inc(t.counter) @@ -103,12 +102,11 @@ proc nodeTableTestOrSet*(t: var TNodeTable, key: PNode, val: int): int = result = t.data[index].val else: if mustRehash(t.data.len, t.counter): - var n: TNodePairSeq - newSeq(n, t.data.len * GrowthFactor) + var n = newSeq[TNodePair](t.data.len * GrowthFactor) for i in 0..high(t.data): if t.data[i].key != nil: nodeTableRawInsert(n, t.data[i].h, t.data[i].key, t.data[i].val) - swap(t.data, n) + t.data = move n nodeTableRawInsert(t.data, k, key, val) result = val inc(t.counter) |