wip ref fixes

This commit is contained in:
Zahary Karadjov 2019-11-25 20:40:30 +02:00
parent ae60eef4e8
commit d79ef0831e
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 9 additions and 3 deletions

View File

@ -37,10 +37,16 @@ template enumInstanceSerializedFields*(obj: auto,
## value being deserialized.
##
type ObjType = type(obj)
type XX = type(default ObjType)
for fieldNameVar, fieldVar in fieldPairs(obj):
when not hasCustomPragmaFixed(ObjType, fieldNameVar, dontSerialize):
body
when obj is ref:
for fieldNameVar, fieldVar in fieldPairs(obj[]):
when not hasCustomPragmaFixed(ObjType, ObjType, fieldNameVar, dontSerialize):
body
else:
for fieldNameVar, fieldVar in fieldPairs(obj):
when not hasCustomPragmaFixed(ObjType, ObjType, fieldNameVar, dontSerialize):
body
macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped =
## Expands a block over all fields of a type