Handle pragma-annotated field names; Fix #28

This commit is contained in:
Zahary Karadjov 2020-06-24 14:08:56 +03:00
parent a49e001f9e
commit e0e51015b7
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 2 additions and 2 deletions

View File

@ -102,12 +102,12 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped =
let
fieldType = field.typ
fieldIdent = field.name
realFieldName = newLit($fieldIdent)
realFieldName = newLit($fieldIdent.skipPragma)
serializedFieldName = field.readPragma("serializedFieldName")
fieldName = if serializedFieldName == nil: realFieldName
else: serializedFieldName
discriminator = newLit(if field.caseField == nil: ""
else: $field.caseField[0])
else: $field.caseField[0].skipPragma)
branches = field.caseBranch
fieldIndex = newLit(i)