next steps for first class iterators
This commit is contained in:
parent
1fada12a5f
commit
7a2c11d3cf
6 changed files with 75 additions and 16 deletions
|
|
@ -406,7 +406,10 @@ proc semFor(c: PContext, n: PNode): PNode =
|
|||
openScope(c.tab)
|
||||
n.sons[length-2] = semExprNoDeref(c, n.sons[length-2], {efWantIterator})
|
||||
var call = n.sons[length-2]
|
||||
if call.kind notin nkCallKinds or call.sons[0].kind != nkSym or
|
||||
if call.kind in nkCallKinds and call.sons[0].typ.callConv == ccClosure:
|
||||
# first class iterator:
|
||||
result = semForVars(c, n)
|
||||
elif call.kind notin nkCallKinds or call.sons[0].kind != nkSym or
|
||||
call.sons[0].sym.kind != skIterator:
|
||||
if length == 3:
|
||||
n.sons[length-2] = implicitIterator(c, "items", n.sons[length-2])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue