diff options
author | Araq <rumpf_a@web.de> | 2014-03-04 08:29:41 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-03-04 08:29:41 +0100 |
commit | f54556518eba317dbe5a4aa86086fa2de8671f7d (patch) | |
tree | c4b48bc6bd554c8df21d7d93831e2422d6a74277 /compiler | |
parent | 74549c327e44adf310c3bcc6aa8db450214b46d0 (diff) | |
download | Nim-f54556518eba317dbe5a4aa86086fa2de8671f7d.tar.gz |
don't produce nested indents for nested stmt lists
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/renderer.nim | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 509c815c1..d68cb91c0 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -558,16 +558,19 @@ proc longMode(n: PNode, start: int = 0, theEnd: int = - 1): bool = result = true break -proc gstmts(g: var TSrcGen, n: PNode, c: TContext) = - if n.kind == nkEmpty: return +proc gstmts(g: var TSrcGen, n: PNode, c: TContext, doIndent=true) = + if n.kind == nkEmpty: return if n.kind in {nkStmtList, nkStmtListExpr, nkStmtListType}: - indentNL(g) - for i in countup(0, sonsLen(n) - 1): + if doIndent: indentNL(g) + for i in countup(0, sonsLen(n) - 1): optNL(g) - gsub(g, n.sons[i]) + if n.sons[i].kind in {nkStmtList, nkStmtListExpr, nkStmtListType}: + gstmts(g, n.sons[i], c, doIndent=false) + else: + gsub(g, n.sons[i]) gcoms(g) - dedent(g) - else: + if doIndent: dedent(g) + else: if rfLongMode in c.flags: indentNL(g) gsub(g, n) gcoms(g) |