Handle pragma-annotated field names; Fix #28
This commit is contained in:
parent
a49e001f9e
commit
e0e51015b7
|
@ -102,12 +102,12 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped =
|
||||||
let
|
let
|
||||||
fieldType = field.typ
|
fieldType = field.typ
|
||||||
fieldIdent = field.name
|
fieldIdent = field.name
|
||||||
realFieldName = newLit($fieldIdent)
|
realFieldName = newLit($fieldIdent.skipPragma)
|
||||||
serializedFieldName = field.readPragma("serializedFieldName")
|
serializedFieldName = field.readPragma("serializedFieldName")
|
||||||
fieldName = if serializedFieldName == nil: realFieldName
|
fieldName = if serializedFieldName == nil: realFieldName
|
||||||
else: serializedFieldName
|
else: serializedFieldName
|
||||||
discriminator = newLit(if field.caseField == nil: ""
|
discriminator = newLit(if field.caseField == nil: ""
|
||||||
else: $field.caseField[0])
|
else: $field.caseField[0].skipPragma)
|
||||||
branches = field.caseBranch
|
branches = field.caseBranch
|
||||||
fieldIndex = newLit(i)
|
fieldIndex = newLit(i)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue