implemented builtin noncopying slice

This commit is contained in:
Araq 2014-05-02 08:44:03 +02:00
commit d0438540d0
7 changed files with 42 additions and 18 deletions

View file

@ -2620,7 +2620,7 @@ proc `[]=`*[Idx, T](a: var array[Idx, T], x: TSlice[int], b: openArray[T]) =
if L == b.len:
for i in 0 .. <L: a[i+x.a] = b[i]
else:
sysFatal(EOutOfRange, "differing lengths for slice assignment")
sysFatal(EOutOfRange, "different lengths for slice assignment")
proc `[]`*[Idx, T](a: array[Idx, T], x: TSlice[Idx]): seq[T] =
## slice operation for arrays. Negative indexes are **not** supported
@ -2642,7 +2642,7 @@ proc `[]=`*[Idx, T](a: var array[Idx, T], x: TSlice[Idx], b: openArray[T]) =
a[j] = b[i]
inc(j)
else:
sysFatal(EOutOfRange, "differing lengths for slice assignment")
sysFatal(EOutOfRange, "different lengths for slice assignment")
proc `[]`*[T](s: seq[T], x: TSlice[int]): seq[T] =
## slice operation for sequences. Negative indexes are supported.

View file

@ -313,6 +313,7 @@ proc mark(gch: var TGcHeap, c: PCell) =
if not containsOrIncl(gch.marked, d):
forAllChildren(d, waMarkPrecise)
else:
# XXX no 'if c.refCount != rcBlack' here?
c.refCount = rcBlack
gcAssert gch.tempStack.len == 0, "stack not empty!"
forAllChildren(c, waMarkPrecise)