summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-01-31 00:47:55 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-01-31 00:47:55 +0100
commit5a33e8795e0ed958ecfe6ff3e7069c8daa1596a8 (patch)
tree5099a157ad2e1cbb1f2539d4ab2924236c926283 /compiler
parenta2db3c24d11c5f6caedf8ac6a24e664d75ba7f80 (diff)
downloadNim-5a33e8795e0ed958ecfe6ff3e7069c8daa1596a8.tar.gz
fixes #3788
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semstmts.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index fdf147a2e..edcf079fa 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1101,6 +1101,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
 
     if n[namePos].kind == nkEmpty:
       s = newSym(kind, idAnon, getCurrOwner(), n.info)
+      incl(s.flags, sfUsed)
       isAnon = true
     else:
       s = semIdentDef(c, n.sons[0], kind)
@@ -1153,9 +1154,10 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
     s.typ.flags.incl(tfIterator)
 
   var proto = searchForProc(c, oldScope, s)
-  if proto == nil:
-    if s.kind == skIterator and s.typ.callConv == ccClosure:
-      discard
+  if proto == nil or isAnon:
+    if s.kind == skIterator:
+      if s.typ.callConv != ccClosure:
+        s.typ.callConv = if isAnon: ccClosure else: ccInline
     else:
       s.typ.callConv = lastOptionEntry(c).defaultCC
     # add it here, so that recursive procs are possible: