From fc3419348381316e7e48118e85cca7c01244e398 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 9 Jul 2019 10:51:41 +0200 Subject: [PATCH] nimpretty: code cleanups --- compiler/lexer.nim | 6 ------ compiler/renderer.nim | 11 ++++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/compiler/lexer.nim b/compiler/lexer.nim index 1eb936130..18479c5eb 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -146,10 +146,6 @@ type previousToken: TLineInfo config*: ConfigRef -when defined(nimpretty): - var - gIndentationWidth*: int - proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} = result = newLineInfo(L.fileIdx, tok.line, tok.col) when defined(nimpretty): @@ -1174,8 +1170,6 @@ proc skip(L: var TLexer, tok: var TToken) = tok.commentOffsetB = L.offsetBase + pos - 1 tok.tokType = tkComment tok.indent = commentIndent - if gIndentationWidth <= 0: - gIndentationWidth = tok.indent proc rawGetTok*(L: var TLexer, tok: var TToken) = template atTokenEnd() {.dirty.} = diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 0a73d6ee9..80ce28666 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -64,14 +64,11 @@ proc renderDefinitionName*(s: PSym, noQuotes = false): string = else: result = '`' & x & '`' -when not defined(nimpretty): - const - IndentWidth = 2 - longIndentWid = IndentWidth * 2 -else: - template IndentWidth: untyped = lexer.gIndentationWidth - template longIndentWid: untyped = IndentWidth() * 2 +const + IndentWidth = 2 + longIndentWid = IndentWidth * 2 +when defined(nimpretty): proc minmaxLine(n: PNode): (int, int) = case n.kind of nkTripleStrLit: