summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-07-01 11:40:13 +0200
committerGitHub <noreply@github.com>2020-07-01 11:40:13 +0200
commit1edb9a6178d868e34e76faf9e2a05afbc1431cb0 (patch)
treee82a873f6f1ea19ff5f58f3a0a7259fa2563a44a /compiler
parent2867a33ebcaddccdb52b101d0ea5f75f1d4bd66f (diff)
downloadNim-1edb9a6178d868e34e76faf9e2a05afbc1431cb0.tar.gz
fix #14401, trailing comma confuses nimpretty (#14867)
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 2477458f1..f5d3084dc 100644
--- a/compiler/layouter.nim
+++ b/compiler/layouter.nim
@@ -452,6 +452,9 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
       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)
+      while em.indentStack[^1] > tok.indent:
+        discard em.indentStack.pop()
+
       # aka: we are in an expression context:
       let alignment = max(tok.indent - em.indentStack[^1], 0)
       em.indentLevel = alignment + em.indentStack.high * em.indWidth