Fix clear() on CountTable
The record tuples used in CountData.data don't contain an 'hcode' member, unlike Table and OrderedTable, causing the existing clearImpl() implementation to break when attempting to assign to t.data[i].hcode.
This commit is contained in:
parent
5e82ffc8d5
commit
edb5a1a5c6
1 changed files with 2 additions and 1 deletions
|
|
@ -142,7 +142,8 @@ template delImpl() {.dirty, immediate.} =
|
|||
|
||||
template clearImpl() {.dirty, immediate.} =
|
||||
for i in 0 .. <t.data.len:
|
||||
t.data[i].hcode = 0
|
||||
when compiles(t.data[i].hcode): # CountTable records don't contain a hcode
|
||||
t.data[i].hcode = 0
|
||||
t.data[i].key = default(type(t.data[i].key))
|
||||
t.data[i].val = default(type(t.data[i].val))
|
||||
t.counter = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue