diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-09-07 01:53:09 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-09-07 19:21:16 +0200 |
commit | 86556ebfdbbd4b8e9edc9d3085ea21d6c0bae2e2 (patch) | |
tree | 9f8b4b752ed728ceff82dceef2f5605cb2a846a0 /compiler/main.nim | |
parent | b5730ec01f02e542eb06161430aa5a7c2ede775f (diff) | |
download | Nim-86556ebfdbbd4b8e9edc9d3085ea21d6c0bae2e2.tar.gz |
compiler refactoring; use typesafe path handing; docgen: render symbols between modules
Diffstat (limited to 'compiler/main.nim')
-rw-r--r-- | compiler/main.nim | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler/main.nim b/compiler/main.nim index cd05ded62..6c8b0343e 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -19,7 +19,7 @@ import cgen, jsgen, json, nversion, platform, nimconf, importer, passaux, depends, vm, vmdef, types, idgen, docgen2, parser, modules, ccgutils, sigmatch, ropes, - modulegraphs, tables, rod, lineinfos + modulegraphs, tables, rod, lineinfos, pathutils from magicsys import resetSysTypes @@ -30,8 +30,8 @@ proc semanticPasses(g: ModuleGraph) = registerPass g, verbosePass registerPass g, semPass -proc writeDepsFile(g: ModuleGraph; project: string) = - let f = open(changeFileExt(project, "deps"), fmWrite) +proc writeDepsFile(g: ModuleGraph; project: AbsoluteFile) = + let f = open(changeFileExt(project, "deps").string, fmWrite) for m in g.modules: if m != nil: f.writeLine(toFullPath(g.config, m.position.FileIndex)) @@ -47,8 +47,9 @@ proc commandGenDepend(graph: ModuleGraph) = let project = graph.config.projectFull writeDepsFile(graph, project) generateDot(graph, project) - execExternalProgram(graph.config, "dot -Tpng -o" & changeFileExt(project, "png") & - ' ' & changeFileExt(project, "dot")) + execExternalProgram(graph.config, "dot -Tpng -o" & + changeFileExt(project, "png").string & + ' ' & changeFileExt(project, "dot").string) proc commandCheck(graph: ModuleGraph) = graph.config.errorMax = high(int) # do not stop after first error @@ -126,7 +127,7 @@ proc commandEval(graph: ModuleGraph; exp: string) = makeStdinModule(graph)) proc commandScan(cache: IdentCache, config: ConfigRef) = - var f = addFileExt(mainCommandArg(config), NimExt) + var f = addFileExt(AbsoluteFile mainCommandArg(config), NimExt) var stream = llStreamOpen(f, fmRead) if stream != nil: var @@ -140,7 +141,7 @@ proc commandScan(cache: IdentCache, config: ConfigRef) = if tok.tokType == tkEof: break closeLexer(L) else: - rawMessage(config, errGenerated, "cannot open file: " & f) + rawMessage(config, errGenerated, "cannot open file: " & f.string) const PrintRopeCacheStats = false @@ -231,11 +232,11 @@ proc mainCommand*(graph: ModuleGraph) = for s in definedSymbolNames(conf.symbols): definedSymbols.elems.add(%s) var libpaths = newJArray() - for dir in conf.searchPaths: libpaths.elems.add(%dir) + for dir in conf.searchPaths: libpaths.elems.add(%dir.string) var dumpdata = % [ (key: "version", val: %VersionAsString), - (key: "project_path", val: %conf.projectFull), + (key: "project_path", val: %conf.projectFull.string), (key: "defined_symbols", val: definedSymbols), (key: "lib_paths", val: libpaths) ] @@ -247,7 +248,7 @@ proc mainCommand*(graph: ModuleGraph) = for s in definedSymbolNames(conf.symbols): msgWriteln(conf, s, {msgStdout, msgSkipHook}) msgWriteln(conf, "-- end of list --", {msgStdout, msgSkipHook}) - for it in conf.searchPaths: msgWriteln(conf, it) + for it in conf.searchPaths: msgWriteln(conf, it.string) of "check": conf.cmd = cmdCheck commandCheck(graph) |