diff options
Diffstat (limited to 'compiler/semtempl.nim')
-rw-r--r-- | compiler/semtempl.nim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index 31624a97f..363c5246f 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -155,7 +155,11 @@ proc addLocalDecl(c: var TemplCtx, n: var PNode, k: TSymKind) = of nkPragmaExpr: x = x[0] of nkIdent: break else: illFormedAst(x) - c.toInject.incl(x.ident.id) + let ident = getIdentNode(c, x) + if not isTemplParam(c, ident): + c.toInject.incl(x.ident.id) + else: + replaceIdentBySym(n, ident) else: let ident = getIdentNode(c, n) if not isTemplParam(c, ident): @@ -348,7 +352,9 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = of nkMethodDef: result = semRoutineInTemplBody(c, n, skMethod) of nkIteratorDef: - result = semRoutineInTemplBody(c, n, n[namePos].sym.kind) + let kind = if hasPragma(n[pragmasPos], wClosure): skClosureIterator + else: skIterator + result = semRoutineInTemplBody(c, n, kind) of nkTemplateDef: result = semRoutineInTemplBody(c, n, skTemplate) of nkMacroDef: @@ -357,6 +363,8 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode = result = semRoutineInTemplBody(c, n, skConverter) of nkPragmaExpr: result.sons[0] = semTemplBody(c, n.sons[0]) + of nkPostfix: + result.sons[1] = semTemplBody(c, n.sons[1]) of nkPragma: discard else: |