toy program works with incremental compilation

This commit is contained in:
Andreas Rumpf 2018-06-07 18:24:16 +02:00
commit 8ba7e7d807
4 changed files with 14 additions and 11 deletions

View file

@ -95,8 +95,13 @@ proc includeModule*(graph: ModuleGraph; s: PSym, fileIdx: FileIndex): PNode {.pr
graph.addDep(s, fileIdx)
graph.addIncludeDep(s.position.FileIndex, fileIdx)
proc connectCallbacks*(graph: ModuleGraph) =
graph.includeFileCallback = includeModule
graph.importModuleCallback = importModule
proc compileSystemModule*(graph: ModuleGraph) =
if graph.systemModule == nil:
connectCallbacks(graph)
graph.config.m.systemFileIdx = fileInfoIdx(graph.config, graph.config.libpath / "system.nim")
discard graph.compileModule(graph.config.m.systemFileIdx, {sfSystemModule})
@ -105,10 +110,6 @@ proc wantMainModule*(conf: ConfigRef) =
fatal(conf, newLineInfo(conf, "command line", 1, 1), errGenerated, "command expects a filename")
conf.projectMainIdx = fileInfoIdx(conf, addFileExt(conf.projectFull, NimExt))
proc connectCallbacks*(graph: ModuleGraph) =
graph.includeFileCallback = includeModule
graph.importModuleCallback = importModule
proc compileProject*(graph: ModuleGraph; projectFileIdx = InvalidFileIDX) =
connectCallbacks(graph)
let conf = graph.config