some fixes for generic first class iterators

This commit is contained in:
Araq 2012-12-15 23:39:27 +01:00
commit cd00679289
4 changed files with 12 additions and 11 deletions

View file

@ -93,9 +93,7 @@ proc instantiateBody(c: PContext, n: PNode, result: PSym) =
# add it here, so that recursive generic procs are possible:
addDecl(c, result)
pushProcCon(c, result)
if result.kind in {skProc, skMethod, skConverter, skMacro}:
addResult(c, result.typ.sons[0], n.info, result.kind)
addResultNode(c, n)
maybeAddResult(c, result, n)
var b = n.sons[bodyPos]
var symMap: TIdTable
InitIdTable symMap
@ -168,6 +166,8 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
result.typ = newTypeS(tyProc, c)
rawAddSon(result.typ, nil)
result.typ.callConv = fn.typ.callConv
if result.kind == skIterator: result.typ.flags.incl(tfIterator)
var oldPrc = GenericCacheGet(c, entry)
if oldPrc == nil:
c.generics.generics.add(entry)