fix floats slice (#16853)

* see whether it breaks

* fix

* fix

* minor

* fix

* add enum

* use Ordinal types

* fix tests

* fix

* another style

* fix remainning cases
This commit is contained in:
flywind
2021-01-29 05:26:36 -06:00
committed by GitHub
parent 44f672a515
commit 4e1e231e29
4 changed files with 11 additions and 11 deletions

View File

@@ -175,7 +175,7 @@ proc `[]`*(n: NimNode, i: BackwardsIndex): NimNode = n[n.len - i.int]
template `^^`(n: NimNode, i: untyped): untyped =
(when i is BackwardsIndex: n.len - int(i) else: int(i))
proc `[]`*[T, U](n: NimNode, x: HSlice[T, U]): seq[NimNode] =
proc `[]`*[T, U: Ordinal](n: NimNode, x: HSlice[T, U]): seq[NimNode] =
## Slice operation for NimNode.
## Returns a seq of child of `n` who inclusive range [n[x.a], n[x.b]].
let xa = n ^^ x.a