raises annotations for some generated procs

This commit is contained in:
Zahary Karadjov 2020-05-30 22:37:23 +03:00
parent 501f94ad61
commit d8ca3daf3a
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 8 additions and 4 deletions

View File

@ -334,7 +334,8 @@ proc genCustomSerializationForField(Format, field,
result.add quote do:
type Reader = ReaderType(`Format`)
proc readFieldIMPL*(F: type FieldTag[`RecordType`, `fieldName`, auto],
`readerSym`: var Reader): `FieldType` =
`readerSym`: var Reader): `FieldType`
{.raises: [IOError, SerializationError, Defect].} =
`readBody`
if writeBody != nil:
@ -343,7 +344,8 @@ proc genCustomSerializationForField(Format, field,
proc writeFieldIMPL*(`writerSym`: var Writer,
F: type FieldTag[`RecordType`, `fieldName`, auto],
`valueSym`: auto,
`holderSym`: `RecordType`) =
`holderSym`: `RecordType`)
{.raises: [IOError, SerializationError, Defect].} =
`writeBody`
proc genCustomSerializationForType(Format, typ: NimNode,
@ -353,13 +355,15 @@ proc genCustomSerializationForType(Format, typ: NimNode,
if readBody != nil:
result.add quote do:
type Reader = ReaderType(`Format`)
proc readValue*(`readerSym`: var Reader, T: type `typ`): `typ` =
proc readValue*(`readerSym`: var Reader, T: type `typ`): `typ`
{.raises: [IOError, SerializationError, Defect].} =
`readBody`
if writeBody != nil:
result.add quote do:
type Writer = WriterType(`Format`)
proc writeValue*(`writerSym`: var Writer, `valueSym`: `typ`) =
proc writeValue*(`writerSym`: var Writer, `valueSym`: `typ`)
{.raises: [IOError, SerializationError, Defect].} =
`writeBody`
macro useCustomSerialization*(Format: typed, field: untyped, body: untyped): untyped =