do not construct empty seq for `yamlScalar`

This commit is contained in:
Vindaar 2018-10-10 17:43:39 +02:00 committed by flyx
parent d19539a231
commit 407b10be66
1 changed files with 1 additions and 7 deletions

View File

@ -1164,13 +1164,7 @@ proc constructChild*(s: var YamlStream, c: ConstructionContext,
proc constructChild*[T](s: var YamlStream, c: ConstructionContext, proc constructChild*[T](s: var YamlStream, c: ConstructionContext,
result: var seq[T]) = result: var seq[T]) =
let item = s.peek() let item = s.peek()
if item.kind == yamlScalar: if item.kind == yamlStartSeq:
#if item.scalarTag == yTagNimNilSeq:
# TODO: this whole branch still makes sense
discard s.next()
result = @[]
return
elif item.kind == yamlStartSeq:
if item.seqTag notin [yTagQuestionMark, yamlTag(seq[T])]: if item.seqTag notin [yTagQuestionMark, yamlTag(seq[T])]:
raise s.constructionError("Wrong tag for " & typetraits.name(seq[T])) raise s.constructionError("Wrong tag for " & typetraits.name(seq[T]))
elif item.seqAnchor != yAnchorNone: elif item.seqAnchor != yAnchorNone: