Restore record pragma handling
This commit is contained in:
parent
f6a9d27ca2
commit
8341360741
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue