summary refs log tree commit diff stats
path: root/compiler/cgen.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-02-01 15:39:56 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-02-01 23:39:40 +0100
commitf04d21f2793933f9b9a54ef2d67dc277e53a0c67 (patch)
treec51450738683304898e24a3065e4e9898a43c86e /compiler/cgen.nim
parent5565b9ef10f5022ea1bdf84fd40c1bca4a6e02e8 (diff)
downloadNim-f04d21f2793933f9b9a54ef2d67dc277e53a0c67.tar.gz
refactoring: explict config state instead of globals
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r--compiler/cgen.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 476b1362f..94a856773 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -1221,7 +1221,7 @@ proc myOpen(graph: ModuleGraph; module: PSym; cache: IdentCache): PPassContext =
   injectG()
   result = newModule(g, module)
   if optGenIndex in gGlobalOptions and g.generatedHeader == nil:
-    let f = if headerFile.len > 0: headerFile else: gProjectFull
+    let f = if graph.config.headerFile.len > 0: graph.config.headerFile else: gProjectFull
     g.generatedHeader = rawNewModule(g, module,
       changeFileExt(completeCFilePath(f), hExt))
     incl g.generatedHeader.flags, isHeaderFile
@@ -1373,11 +1373,12 @@ proc myClose(b: PPassContext, n: PNode): PNode =
     for i in 0..sonsLen(disp)-1: genProcAux(m, disp.sons[i].sym)
     genMainProc(m)
 
-proc cgenWriteModules*(backend: RootRef) =
+proc cgenWriteModules*(backend: RootRef, config: ConfigRef) =
   let g = BModuleList(backend)
   # we need to process the transitive closure because recursive module
   # deps are allowed (and the system module is processed in the wrong
   # order anyway)
+  g.config = config
   if g.generatedHeader != nil: finishModule(g.generatedHeader)
   while g.forwardedProcsCounter > 0:
     for m in cgenModules(g):