macros.nim: added missing pairs iterator

This commit is contained in:
Araq
2017-10-20 17:23:36 +02:00
parent 14e236af05
commit 0be71677d9

View File

@@ -986,6 +986,11 @@ iterator items*(n: NimNode): NimNode {.inline.} =
for i in 0 ..< n.len:
yield n[i]
iterator pairs*(n: NimNode): (int, NimNode) {.inline.} =
## Iterates over the children of the NimNode ``n`` and its indices.
for i in 0 ..< n.len:
yield (i, n[i])
iterator children*(n: NimNode): NimNode {.inline.} =
## Iterates over the children of the NimNode ``n``.
for i in 0 ..< n.len: