diff --git a/yaml/parser.nim b/yaml/parser.nim index 22d583c..fd93547 100644 --- a/yaml/parser.nim +++ b/yaml/parser.nim @@ -448,7 +448,7 @@ proc atBlockIndentationProps(c: Context, e: var Event): bool = if c.lex.cur == Token.MapValueInd: if c.lex.lastScalarWasMultiline(): raise c.generateError("Implicit mapping key may not be multiline") - c.keyCache.add(e) + c.keyCache.add(move(e)) e = startMapEvent(csBlock, c.headerProps, c.headerStart, headerEnd) c.headerProps = defaultProperties c.transition(afterImplicitKey) @@ -502,7 +502,7 @@ proc beforeNodeProperties(c: Context, e: var Event): bool = of VerbatimTag: if c.inlineProps.tag != yTagQuestionMark: raise c.generateError("Only one tag allowed per node") - c.inlineProps.tag = Tag(c.lex.evaluated) + c.inlineProps.tag = Tag(move(c.lex.evaluated)) of Token.Anchor: if c.inlineProps.anchor != yAnchorNone: raise c.generateError("Only one anchor allowed per node") diff --git a/yaml/private/internal.nim b/yaml/private/internal.nim index c24cb49..35e869d 100644 --- a/yaml/private/internal.nim +++ b/yaml/private/internal.nim @@ -53,7 +53,7 @@ proc nextAnchor*(s: var string, i: int) = s[i] = 'a' nextAnchor(s, i - 1) else: - inc(s[i]) + s[i] = char(int(s[i]) + 1) template resetHandles*(handles: var seq[tuple[handle, uriPrefix: string]]) {.dirty.} = handles.setLen(0) diff --git a/yaml/serialization.nim b/yaml/serialization.nim index de820bb..c69770a 100644 --- a/yaml/serialization.nim +++ b/yaml/serialization.nim @@ -414,7 +414,7 @@ proc constructObject*[T](s: var YamlStream, c: ConstructionContext, while s.peek().kind != yamlEndSeq: var item: T constructChild(s, c, item) - result.add(item) + result.add(move(item)) discard s.next() proc constructObject*[T](s: var YamlStream, c: ConstructionContext, @@ -530,7 +530,7 @@ proc constructObject*[K, V](s: var YamlStream, c: ConstructionContext, raise s.constructionError(event.startPos, "Expected map end, got " & $event.kind) if result.contains(key): raise s.constructionError(event.startPos, "Duplicate table key!") - result.add(key, value) + result[move(key)] = move(value) discard s.next() proc representObject*[K, V](value: OrderedTable[K, V], ts: TagStyle, @@ -1292,7 +1292,6 @@ proc representChild*[T](value: Option[T], ts: TagStyle, if value.isSome: representChild(value.get(), ts, c) else: - let childTagStyle = if ts == tsRootOnly: tsNone else: ts c.put(scalarEvent("~", yTagNull)) proc representChild*[O](value: O, ts: TagStyle, @@ -1324,7 +1323,7 @@ proc construct*[T](s: var YamlStream, target: var T) raise (ref YamlConstructionError)(getCurrentException()) except YamlStreamError: let cur = getCurrentException() - var e = newException(YamlStreamError, cur.msg) + var e = newException(YamlStreamError, move(cur.msg)) e.parent = cur.parent raise e except Exception: