workaround to allow compile time deserialization

with this refactoring, deserialization can be enabled for VM context
see toml-serialization for example
This commit is contained in:
jangko 2022-06-19 14:50:00 +07:00
parent d856d6ece5
commit 90276771dc
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 2 additions and 1 deletions

View File

@ -225,8 +225,9 @@ proc makeFieldReadersTable(RecordType, ReaderType: distinct type):
except SerializationError as err:
raise err
except CatchableError as err:
type LocalRecordType = `RecordType` # workaround to allow compile time evaluation
reader.handleReadException(
`RecordType`,
LocalRecordType,
fieldName,
when RecordType is tuple: obj[i] else: field(obj, realFieldName),
err)