diff options
author | Araq <rumpf_a@web.de> | 2017-10-20 17:23:36 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-10-25 17:37:03 +0200 |
commit | 0be71677d99511c210d7ff62e642dcb32956ed5d (patch) | |
tree | cd2bcd4c2f33339bb427803291a54803d7304139 /lib/core/macros.nim | |
parent | 14e236af05985516a4ebab10c3b97dfed1d60c8e (diff) | |
download | Nim-0be71677d99511c210d7ff62e642dcb32956ed5d.tar.gz |
macros.nim: added missing pairs iterator
Diffstat (limited to 'lib/core/macros.nim')
-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: |