This commit is contained in:
Araq 2018-10-18 16:53:49 +02:00
commit ec4985a573
2 changed files with 28 additions and 10 deletions

View file

@ -199,17 +199,20 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
result[i] = defs result[i] = defs
proc transformConstSection(c: PTransf, v: PNode): PTransNode = proc transformConstSection(c: PTransf, v: PNode): PTransNode =
result = newTransNode(v) result = PTransNode(v)
for i in countup(0, sonsLen(v)-1): when false:
var it = v.sons[i] result = newTransNode(v)
if it.kind == nkCommentStmt: for i in countup(0, sonsLen(v)-1):
result[i] = PTransNode(it) var it = v.sons[i]
else: if it.kind == nkCommentStmt:
if it.kind != nkConstDef: internalError(c.graph.config, it.info, "transformConstSection") result[i] = PTransNode(it)
if it.sons[0].kind != nkSym: else:
internalError(c.graph.config, it.info, "transformConstSection") if it.kind != nkConstDef: internalError(c.graph.config, it.info, "transformConstSection")
if it.sons[0].kind != nkSym:
debug it.sons[0]
internalError(c.graph.config, it.info, "transformConstSection")
result[i] = PTransNode(it) result[i] = PTransNode(it)
proc hasContinue(n: PNode): bool = proc hasContinue(n: PNode): bool =
case n.kind case n.kind

View file

@ -17,3 +17,18 @@ if true:
writeLine stdout, "2" writeLine stdout, "2"
write stdout, "3" write stdout, "3"
echo "4" echo "4"
# bug #7972
template optimizeLogWrites*{
write(f, x)
write(f, y)
}(x, y: string{lit}, f: File) =
write(f, x & y)
proc foo() =
const N = 1
stdout.write("")
stdout.write("")
foo()