NimNode needs an items iterator to be used nicely in for statements

This commit is contained in:
transfuturist
2015-05-15 21:55:06 -07:00
parent 4ac0804187
commit 939c0a6bb8

View File

@@ -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).