diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-08-09 15:12:30 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-08-09 15:12:30 +0200 |
commit | 1a470d181854b078cf16e6cb6f7802fea8814680 (patch) | |
tree | 3756b895310e92728d02733ab070841077cff8d5 /compiler | |
parent | 440ed8eb68e3b602f6330d7aa54cff4447d0f0bf (diff) | |
download | Nim-1a470d181854b078cf16e6cb6f7802fea8814680.tar.gz |
fixes #2094
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semstmts.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index ab9ecd1a6..5d1770a32 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1309,6 +1309,7 @@ proc determineType(c: PContext, s: PSym) = proc semIterator(c: PContext, n: PNode): PNode = # gensym'ed iterator? + let isAnon = n[namePos].kind == nkEmpty if n[namePos].kind == nkSym: # gensym'ed iterators might need to become closure iterators: n[namePos].sym.owner = getCurrOwner() @@ -1318,6 +1319,8 @@ proc semIterator(c: PContext, n: PNode): PNode = var t = s.typ if t.sons[0] == nil and s.typ.callConv != ccClosure: localError(n.info, errXNeedsReturnType, "iterator") + if isAnon and s.typ.callConv == ccInline: + localError(n.info, "inline iterators are not first-class / cannot be assigned to variables") # iterators are either 'inline' or 'closure'; for backwards compatibility, # we require first class iterators to be marked with 'closure' explicitly # -- at least for 0.9.2. |