From 939c0a6bb8c21c036bdb7bc44cf866b947b11696 Mon Sep 17 00:00:00 2001 From: transfuturist Date: Fri, 15 May 2015 21:55:06 -0700 Subject: NimNode needs an items iterator to be used nicely in for statements --- lib/core/macros.nim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/core/macros.nim') 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). -- cgit 1.4.1-2-gfad0