use system.move instead of system.shallowCopy if the GC mode requires it

This commit is contained in:
Andreas Rumpf 2019-10-03 16:46:09 +02:00
commit 60d64d1aef
14 changed files with 61 additions and 36 deletions

View file

@ -302,12 +302,18 @@ template piRest*(my: XmlParser): string =
proc rawData*(my: XmlParser): string {.inline.} =
## returns the underlying 'data' string by reference.
## This is only used for speed hacks.
shallowCopy(result, my.a)
when defined(gcDestructors):
result = move(my.a)
else:
shallowCopy(result, my.a)
proc rawData2*(my: XmlParser): string {.inline.} =
## returns the underlying second 'data' string by reference.
## This is only used for speed hacks.
shallowCopy(result, my.b)
when defined(gcDestructors):
result = move(my.b)
else:
shallowCopy(result, my.b)
proc getColumn*(my: XmlParser): int {.inline.} =
## get the current column the parser has arrived at.