summary refs log tree commit diff stats
path: root/compiler/sem.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-08-05 14:17:24 +0200
committerAraq <rumpf_a@web.de>2018-08-05 14:17:24 +0200
commit7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a (patch)
tree2e79c210ccd19a7065b36992e19ab74ff061f5df /compiler/sem.nim
parent282c4f3d0a72fbb4c49df51048e2e13fafcd8659 (diff)
parent74842ed4a981b6ff168d67d05ee92dce350549cb (diff)
downloadNim-7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a.tar.gz
make at least bootstrapping work
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r--compiler/sem.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 0d484d276..2c3fab5a5 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -608,16 +608,18 @@ proc myProcess(context: PPassContext, n: PNode): PNode =
   rod.storeNode(c.graph, c.module, result)
 
 proc testExamples(c: PContext) =
+  let outputDir = c.config.getNimcacheDir / "runnableExamples"
+  createDir(outputDir)
   let inp = toFullPath(c.config, c.module.info)
-  let outp = inp.changeFileExt"" & "_examples.nim"
+  let outp = outputDir / extractFilename(inp.changeFileExt"" & "_examples.nim")
   let nimcache = outp.changeFileExt"" & "_nimcache"
-  renderModule(c.runnableExamples, inp, outp)
+  renderModule(c.runnableExamples, inp, outp, conf = c.config)
   let backend = if isDefined(c.config, "js"): "js"
                 elif isDefined(c.config, "cpp"): "cpp"
                 elif isDefined(c.config, "objc"): "objc"
                 else: "c"
   if os.execShellCmd(os.getAppFilename() & " " & backend & " --nimcache:" & nimcache & " -r " & outp) != 0:
-    quit "[Examples] failed"
+    quit "[Examples] failed: see " & outp
   else:
     removeFile(outp)
     removeFile(outp.changeFileExt(ExeExt))