summary refs log tree commit diff stats
path: root/compiler/nimfix/prettybase.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-05-17 15:21:22 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-05-17 15:21:22 +0200
commitbf6c2c5ccfd33cc8aab53b98dbce0619f8633d84 (patch)
treebafa67febeed93ac44278d593ca26b1cb22ea32d /compiler/nimfix/prettybase.nim
parent2a7fc84c86c48c6ca6354c8c2f9232c3f1a0b049 (diff)
downloadNim-bf6c2c5ccfd33cc8aab53b98dbce0619f8633d84.tar.gz
preparations of making compiler/msgs.nim free of global variables
Diffstat (limited to 'compiler/nimfix/prettybase.nim')
-rw-r--r--compiler/nimfix/prettybase.nim18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/nimfix/prettybase.nim b/compiler/nimfix/prettybase.nim
index c32dbe623..89c48ae6e 100644
--- a/compiler/nimfix/prettybase.nim
+++ b/compiler/nimfix/prettybase.nim
@@ -8,7 +8,7 @@
 #
 
 import strutils, lexbase, streams
-import ".." / [ast, msgs, idents]
+import ".." / [ast, msgs, idents, options]
 from os import splitFile
 
 type
@@ -21,14 +21,14 @@ type
 var
   gSourceFiles*: seq[TSourceFile] = @[]
 
-proc loadFile*(info: TLineInfo) =
+proc loadFile*(conf: ConfigRef; info: TLineInfo) =
   let i = info.fileIndex.int
   if i >= gSourceFiles.len:
     gSourceFiles.setLen(i+1)
   if gSourceFiles[i].lines.isNil:
     gSourceFiles[i].fileIdx = info.fileIndex
     gSourceFiles[i].lines = @[]
-    let path = info.toFullPath
+    let path = toFullPath(conf, info)
     gSourceFiles[i].fullpath = path
     gSourceFiles[i].isNimfixFile = path.splitFile.ext == ".nimfix"
     # we want to die here for IOError:
@@ -61,8 +61,8 @@ proc differ*(line: string, a, b: int, x: string): bool =
   let y = line[a..b]
   result = cmpIgnoreStyle(y, x) == 0 and y != x
 
-proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PIdent) =
-  loadFile(info)
+proc replaceDeprecated*(conf: ConfigRef; info: TLineInfo; oldSym, newSym: PIdent) =
+  loadFile(conf, info)
 
   let line = gSourceFiles[info.fileIndex.int32].lines[info.line.int-1]
   var first = min(info.col.int, line.len)
@@ -79,11 +79,11 @@ proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PIdent) =
     gSourceFiles[info.fileIndex.int32].dirty = true
     #if newSym.s == "File": writeStackTrace()
 
-proc replaceDeprecated*(info: TLineInfo; oldSym, newSym: PSym) =
-  replaceDeprecated(info, oldSym.name, newSym.name)
+proc replaceDeprecated*(conf: ConfigRef; info: TLineInfo; oldSym, newSym: PSym) =
+  replaceDeprecated(conf, info, oldSym.name, newSym.name)
 
-proc replaceComment*(info: TLineInfo) =
-  loadFile(info)
+proc replaceComment*(conf: ConfigRef; info: TLineInfo) =
+  loadFile(conf, info)
 
   let line = gSourceFiles[info.fileIndex.int32].lines[info.line.int-1]
   var first = info.col.int