avoid threadvar (#107)
This commit is contained in:
parent
d5274f8e97
commit
2717b21b87
|
@ -71,18 +71,18 @@ proc readValue*[T](r: var WinregReader, value: var T)
|
||||||
elif T is (object or tuple):
|
elif T is (object or tuple):
|
||||||
type T = type(value)
|
type T = type(value)
|
||||||
when T.totalSerializedFields > 0:
|
when T.totalSerializedFields > 0:
|
||||||
let fields = T.fieldReadersTable(WinregReader)
|
const fields = T.fieldReadersTable(WinregReader)
|
||||||
var expectedFieldPos = 0
|
var expectedFieldPos = 0
|
||||||
r.key.add ""
|
r.key.add ""
|
||||||
value.enumInstanceSerializedFields(fieldName, field):
|
value.enumInstanceSerializedFields(fieldName, field):
|
||||||
when T is tuple:
|
when T is tuple:
|
||||||
r.key[^1] = $expectedFieldPos
|
r.key[^1] = $expectedFieldPos
|
||||||
var reader = fields[][expectedFieldPos].reader
|
var reader = fields[expectedFieldPos].reader
|
||||||
expectedFieldPos += 1
|
expectedFieldPos += 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
r.key[^1] = fieldName
|
r.key[^1] = fieldName
|
||||||
var reader = findFieldReader(fields[], fieldName, expectedFieldPos)
|
var reader = findFieldReader(fields, fieldName, expectedFieldPos)
|
||||||
|
|
||||||
if reader != nil:
|
if reader != nil:
|
||||||
reader(value, r)
|
reader(value, r)
|
||||||
|
|
Loading…
Reference in New Issue