added system.finished for first class iterators

This commit is contained in:
Araq 2012-11-17 01:25:32 +01:00
commit 7f6633a06f
8 changed files with 55 additions and 12 deletions

View file

@ -692,13 +692,6 @@ proc liftIterator*(iter: PSym, body: PNode): PNode =
stateAsgnStmt.add(newIntTypeNode(nkIntLit, -1, getSysType(tyInt)))
result.add(stateAsgnStmt)
# TODO:
# - nested iterators
# - arglist as a type
# - tyIterator everywhere
# - 'finished' builtin
# - 'start' builtin (XXX copy Lua's terminology?)
proc liftIterSym*(n: PNode): PNode =
# transforms (iter) to (let env = newClosure[iter](); (iter, env))
result = newNodeIT(nkStmtListExpr, n.info, n.typ)