mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-22 08:51:21 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user