[bugfix] system.nim: make pop work with --newruntime

(cherry picked from commit 280193cc07)
This commit is contained in:
Andreas Rumpf
2019-06-20 19:39:42 +02:00
committed by narimiran
parent cd49bba7b3
commit f3ae2dcfa3

View File

@@ -3071,8 +3071,12 @@ proc pop*[T](s: var seq[T]): T {.inline, noSideEffect.} =
assert a == @[1, 3, 5]
var L = s.len-1
result = s[L]
setLen(s, L)
when defined(nimV2):
result = move s[L]
shrink(s, L)
else:
result = s[L]
setLen(s, L)
proc `==`*[T: tuple|object](x, y: T): bool =
## Generic ``==`` operator for tuples that is lifted from the components.