Fix toPreserveHook for Table[A, B]

The toPreserveHook for tables was not compiling, which would fall
back to the behavior for preserving objects, which would not work
for tables.
This commit is contained in:
Emery Hemingway 2021-09-21 07:58:06 +02:00
parent 7edc05a35d
commit dae5dd9751
1 changed files with 2 additions and 2 deletions

View File

@ -574,8 +574,8 @@ proc toPreserveHook*[T](set: HashSet[T]): Preserve =
proc toPreserveHook*[A, B](table: Table[A, B]|TableRef[A, B]): Preserve =
## Hook for preserving ``Table``.
result = Preserve(kind: pkDictionary, dict: initTable[Preserve, Preserve](table.len))
for k, v in table.pairs: result.dict.add((k.toPreserve, v.toPreserve, ))
result = initDictionary()
for k, v in table.pairs: result[k.toPreserve] = v.toPreserve
proc fromPreserve*[T](v: var T; pr: Preserve): bool =
## Inplace version of `preserveTo`. Returns ``true`` on