Restore record pragma handling

This commit is contained in:
Emery Hemingway 2021-08-24 17:29:29 +02:00
parent f6a9d27ca2
commit 8341360741
1 changed files with 1 additions and 3 deletions

View File

@ -1,3 +1,4 @@
# SPDX-FileCopyrightText: 2021 ☭ Emery Hemingway
# SPDX-License-Identifier: ISC
import bigints
@ -602,15 +603,12 @@ proc toPreserve*[T](x: T): Preserve =
elif T is float64:
result = Preserve(kind: pkDouble, double: x)
elif T is object | tuple:
#[
when T.hasCustomPragma(unpreservable): {.fatal: "unpreservable type".}
elif T.hasCustomPragma(record):
result = Preserve(kind: pkRecord)
for _, f in x.fieldPairs: result.record.add(toPreserve(f))
result.record.add(symbol(T.getCustomPragmaVal(record)))
else:
]#
block:
result = Preserve(kind: pkDictionary)
for k, v in x.fieldPairs: result.dict[symbol(k)] = toPreserve(v)
elif T is Ordinal: