more refactoring

This commit is contained in:
Andreas Rumpf 2018-05-27 15:22:17 +02:00
commit 18a3833d60
11 changed files with 36 additions and 33 deletions

View file

@ -12,7 +12,7 @@
when not defined(nimpretty):
{.error: "This needs to be compiled with --define:nimPretty".}
import ../compiler / [idents, msgs, ast, syntaxes, renderer]
import ../compiler / [idents, msgs, ast, syntaxes, renderer, options]
import parseopt, strutils, os
@ -40,8 +40,9 @@ proc writeVersion() =
quit(0)
proc prettyPrint(infile: string) =
let fileIdx = fileInfoIdx(infile)
let tree = parseFile(fileIdx, newIdentCache())
let conf = newConfigRef()
let fileIdx = fileInfoIdx(conf, infile)
let tree = parseFile(fileIdx, newIdentCache(), conf)
let outfile = changeFileExt(infile, ".pretty.nim")
renderModule(tree, infile, outfile, {}, fileIdx)