first attempt to fix 'a[i]' handling in generics

This commit is contained in:
Araq
2015-09-12 10:55:28 +02:00
parent 2a797c362a
commit 8ef66b973d
13 changed files with 153 additions and 7 deletions

View File

@@ -239,6 +239,14 @@ type
seq*{.magic: "Seq".}[T] ## Generic type to construct sequences.
set*{.magic: "Set".}[T] ## Generic type to construct bit sets.
when defined(nimArrIdx):
# :array|openarray|string|seq|cstring|tuple
proc `[]`*[I: Ordinal;T](a: T; i: I): T {.
noSideEffect, magic: "ArrGet".}
proc `[]=`*[I: Ordinal;T,S](a: var T; i: I;
x: S) {.noSideEffect, magic: "ArrPut".}
proc `=`*[T](dest: var T; src: T) {.noSideEffect, magic: "Asgn".}
type
Slice*[T] = object ## builtin slice type
a*, b*: T ## the bounds