nimpretty: code cleanups

(cherry picked from commit fc34193483)
This commit is contained in:
Araq
2019-07-09 10:51:41 +02:00
committed by narimiran
parent e0b4d034bc
commit 2a0c9dc063
2 changed files with 4 additions and 13 deletions

View File

@@ -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.} =

View File

@@ -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: