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:
Kier Davis 2016-06-18 15:43:32 +01:00
commit edb5a1a5c6

View file

@ -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