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

@ -818,7 +818,7 @@ proc semIterator(c: PContext, n: PNode): PNode =
result = semProcAux(c, n, skIterator, iteratorPragmas)
var s = result.sons[namePos].sym
var t = s.typ
if t.sons[0] == nil:
if t.sons[0] == nil and s.typ.callConv != ccClosure:
LocalError(n.info, errXNeedsReturnType, "iterator")
# iterators are either 'inline' or 'closure'; for backwards compatibility,
# we require first class iterators to be marked with 'closure' explicitly