Never convert Preserves symbols to Nim strings!
This commit is contained in:
parent
9fa6685071
commit
47e7851beb
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20230612"
|
version = "20230720"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -1057,15 +1057,9 @@ proc fromPreserve*[T, E](v: var T; pr: Preserve[E]): bool =
|
||||||
v = (T)pr.int
|
v = (T)pr.int
|
||||||
result = true
|
result = true
|
||||||
elif T is string:
|
elif T is string:
|
||||||
case pr.kind
|
if pr.kind == pkString:
|
||||||
of pkString:
|
|
||||||
v = pr.string
|
v = pr.string
|
||||||
result = true
|
result = true
|
||||||
of pkSymbol:
|
|
||||||
# loose convertability of Preserves symbol to Nim string
|
|
||||||
v = string pr.symbol
|
|
||||||
result = true
|
|
||||||
else: discard
|
|
||||||
elif T is Symbol:
|
elif T is Symbol:
|
||||||
if pr.kind == pkSymbol:
|
if pr.kind == pkSymbol:
|
||||||
v = pr.symbol
|
v = pr.symbol
|
||||||
|
|
Loading…
Reference in New Issue