use typeof instead type (#16962)
This commit is contained in:
parent
4fac8af0c9
commit
d447c0fe3f
31 changed files with 253 additions and 253 deletions
|
|
@ -117,8 +117,8 @@ template delImplIdx(t, i, makeEmpty, cellEmpty, cellHash) =
|
|||
var j = i # The correctness of this depends on (h+1) in nextTry
|
||||
var r = j # though may be adaptable to other simple sequences.
|
||||
makeEmpty(i) # mark current EMPTY
|
||||
t.data[i].key = default(type(t.data[i].key))
|
||||
t.data[i].val = default(type(t.data[i].val))
|
||||
t.data[i].key = default(typeof(t.data[i].key))
|
||||
t.data[i].val = default(typeof(t.data[i].val))
|
||||
while true:
|
||||
i = (i + 1) and msk # increment mod table size
|
||||
if cellEmpty(i): # end of collision cluster; So all done
|
||||
|
|
@ -149,8 +149,8 @@ template clearImpl() {.dirty.} =
|
|||
for i in 0 ..< t.dataLen:
|
||||
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.data[i].key = default(typeof(t.data[i].key))
|
||||
t.data[i].val = default(typeof(t.data[i].val))
|
||||
t.counter = 0
|
||||
|
||||
template ctAnd(a, b): bool =
|
||||
|
|
@ -161,7 +161,7 @@ template ctAnd(a, b): bool =
|
|||
|
||||
template initImpl(result: typed, size: int) =
|
||||
let correctSize = slotsNeeded(size)
|
||||
when ctAnd(declared(SharedTable), type(result) is SharedTable):
|
||||
when ctAnd(declared(SharedTable), typeof(result) is SharedTable):
|
||||
init(result, correctSize)
|
||||
else:
|
||||
result.counter = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue