diff options
author | Miran <narimiran@disroot.org> | 2020-07-01 11:40:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-01 11:40:13 +0200 |
commit | 1edb9a6178d868e34e76faf9e2a05afbc1431cb0 (patch) | |
tree | e82a873f6f1ea19ff5f58f3a0a7259fa2563a44a /compiler | |
parent | 2867a33ebcaddccdb52b101d0ea5f75f1d4bd66f (diff) | |
download | Nim-1edb9a6178d868e34e76faf9e2a05afbc1431cb0.tar.gz |
fix #14401, trailing comma confuses nimpretty (#14867)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/layouter.nim | 3 |
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 |