summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authornarimiran <narimiran@disroot.org>2019-08-19 13:35:10 +0200
committernarimiran <narimiran@disroot.org>2019-08-19 13:35:10 +0200
commitceb742351af3aa9caecd4828756ea3108806be52 (patch)
treee1b381529b8dac4bb2e96af42aa22679a7e1384f /compiler
parentcf4390a24adde453cd3a4a1e4889305b61b295e4 (diff)
downloadNim-ceb742351af3aa9caecd4828756ea3108806be52.tar.gz
nimpretty: fix #11937 (wrong indentation)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/layouter.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim
index 7df32ec4c..0c888b455 100644
--- a/compiler/layouter.nim
+++ b/compiler/layouter.nim
@@ -441,6 +441,9 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
       em.indentLevel = tok.indent
     elif (em.lastTok in (splitters + oprSet) and
         tok.tokType notin (closedPars - {tkBracketDotRi})):
+      if tok.tokType in openPars and tok.indent > em.indentStack[^1]:
+        while em.indentStack[^1] < tok.indent:
+          em.indentStack.add(em.indentStack[^1] + em.indWidth)
       # aka: we are in an expression context:
       let alignment = max(tok.indent - em.indentStack[^1], 0)
       em.indentLevel = alignment + em.indentStack.high * em.indWidth