another attempt to reduce compiler warnings

This commit is contained in:
jangko 2023-06-05 11:43:19 +07:00
parent b7c085fc5c
commit 09b131c919
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 7 additions and 5 deletions

View File

@ -23,13 +23,12 @@ template encode*(Format: type, value: auto, params: varargs[untyped]): auto =
raise (ref Defect)() # a memoryOutput cannot have an IOError
# TODO Nim cannot make sense of this initialization by var param?
{.push warning[ProveInit]: off.}
proc readValue*(reader: var auto, T: type): T =
{.warning[ProveInit]: off.}
mixin readValue
when (NimMajor, NimMinor) > (1, 6):
result = default(T)
result = default(T)
reader.readValue(result)
{.pop.}
{.warning[ProveInit]: on.}
template decode*(Format: distinct type,
input: string,

View File

@ -197,7 +197,10 @@ template readFieldIMPL[Reader](field: type FieldTag,
# additional notes: putting the FieldType coercion in
# `makeFieldReadersTable` will cause problems when orc enabled
# hence, move it here
FieldType reader.readValue(FieldType)
when distinctBase(FieldType) isnot FieldType:
FieldType reader.readValue(FieldType)
else:
reader.readValue(FieldType)
template writeFieldIMPL*[Writer](writer: var Writer,
fieldTag: type FieldTag,