improvements for TR macros

This commit is contained in:
Araq 2013-09-17 23:43:07 +02:00
commit 9de3bc8ef6
6 changed files with 53 additions and 21 deletions

View file

@ -574,9 +574,14 @@ proc semForFields(c: PContext, n: PNode, m: TMagic): PNode =
fc.c = c
semForObjectFields(fc, tupleTypeA.n, n, stmts)
Dec(c.p.nestedLoopCounter)
var b = newNodeI(nkBreakStmt, n.info)
b.add(ast.emptyNode)
stmts.add(b)
# for TR macros this 'while true: ...; break' loop is pretty bad, so
# we avoid it now if we can:
if hasSonWith(stmts, nkBreakStmt):
var b = newNodeI(nkBreakStmt, n.info)
b.add(ast.emptyNode)
stmts.add(b)
else:
result = stmts
proc addForVarDecl(c: PContext, v: PSym) =
if warnShadowIdent in gNotes: