Allocate new TableRefs when necessary

This commit is contained in:
Emery Hemingway 2022-10-13 23:05:37 -05:00
parent a97f1e8554
commit 54ec2d439a
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "20220904"
version = "20221013"
author = "Emery Hemingway"
description = "data model and serialization format"
license = "Unlicense"

View File

@ -1028,6 +1028,8 @@ proc fromPreserveHook*[T, E](set: var HashSet[T]; pr: Preserve[E]): bool =
proc fromPreserveHook*[A,B,E](t: var (Table[A,B]|TableRef[A,B]); pr: Preserve[E]): bool =
if pr.isDictionary:
when t is TableRef[A,B]:
if t.isNil: new t
result = true
var a: A
var b: B