Handle record types with when statements
This commit is contained in:
parent
474bdbf49c
commit
dfd6e349a6
|
@ -131,14 +131,15 @@ macro enumAllSerializedFieldsImpl(T: type, body: untyped): untyped =
|
||||||
|
|
||||||
result.add quote do:
|
result.add quote do:
|
||||||
block:
|
block:
|
||||||
`fieldNameDefs`
|
when compiles(type(`field`)):
|
||||||
|
`fieldNameDefs`
|
||||||
|
|
||||||
type FieldType {.inject, used.} = type(`field`)
|
type FieldType {.inject, used.} = type(`field`)
|
||||||
|
|
||||||
template fieldCaseDiscriminator: auto {.used.} = `discriminator`
|
template fieldCaseDiscriminator: auto {.used.} = `discriminator`
|
||||||
template fieldCaseBranches: auto {.used.} = `branches`
|
template fieldCaseBranches: auto {.used.} = `branches`
|
||||||
|
|
||||||
`body`
|
`body`
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue