diff options
author | transfuturist <timothy.schmid@gmail.com> | 2015-05-15 21:55:06 -0700 |
---|---|---|
committer | transfuturist <timothy.schmid@gmail.com> | 2015-05-16 10:52:44 -0700 |
commit | 939c0a6bb8c21c036bdb7bc44cf866b947b11696 (patch) | |
tree | ebb9ca85e9edb42b38d46c4ed843eeb5e7ae4f3a /lib/core/macros.nim | |
parent | 4ac080418753b2af509642f1cfad3ab5a61e7596 (diff) | |
download | Nim-939c0a6bb8c21c036bdb7bc44cf866b947b11696.tar.gz |
NimNode needs an items iterator to be used nicely in for statements
Diffstat (limited to 'lib/core/macros.nim')
-rw-r--r-- | lib/core/macros.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 35f0f61c1..becfd2d94 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -712,6 +712,10 @@ iterator children*(n: NimNode): NimNode {.inline.}= for i in 0 .. high(n): yield n[i] +iterator items*(n: NimNode): NimNode {.inline.}= + for i in 0 .. high(n): + yield n[i] + template findChild*(n: NimNode; cond: expr): NimNode {. immediate, dirty.} = ## Find the first child node matching condition (or nil). |