summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-24 15:19:29 +0200
committerAraq <rumpf_a@web.de>2018-10-24 15:19:29 +0200
commit06a6433db7cc32e957d4f78640e388ea5d09b1a3 (patch)
tree525bd165709f1f0c952b6b1d5209b6c98354b803 /compiler
parent85000766518bac45b712c26511cf4d39c3e845a6 (diff)
downloadNim-06a6433db7cc32e957d4f78640e388ea5d09b1a3.tar.gz
nimpretty: test for idempotence; fixes #9483
Diffstat (limited to 'compiler')
-rw-r--r--compiler/lexer.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index f9fa10a0b..47083216a 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -1140,7 +1140,10 @@ proc skip(L: var TLexer, tok: var TToken) =
           inc(pos)
           inc(indent)
         elif buf[pos] == '#' and buf[pos+1] == '[':
-          when defined(nimpretty): hasComment = true
+          when defined(nimpretty):
+            hasComment = true
+            if tok.line < 0:
+              tok.line = L.lineNumber
           skipMultiLineComment(L, tok, pos+2, false)
           pos = L.bufpos
           buf = L.buf
@@ -1160,7 +1163,6 @@ proc skip(L: var TLexer, tok: var TToken) =
         hasComment = true
         if tok.line < 0:
           tok.line = L.lineNumber
-          #commentIndent = L.currLineIndent # if tok.strongSpaceA == 0: -1 else: tok.strongSpaceA
 
       if buf[pos+1] == '[':
         skipMultiLineComment(L, tok, pos+2, false)