diff options
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 8c70d2b47..22c479a4a 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -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: |