summary refs log tree commit diff stats
path: root/compiler/nim.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-05-11 03:01:18 -0700
committerGitHub <noreply@github.com>2020-05-11 12:01:18 +0200
commit9502e39b634eea8e04f07ddc110b466387f42322 (patch)
tree240ffa98d6f1d556986dccbb66e9f5e0e81675e4 /compiler/nim.nim
parentd11cb9d49596957e9fa097110cf19e9caf085592 (diff)
downloadNim-9502e39b634eea8e04f07ddc110b466387f42322.tar.gz
`nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, `--doccmd:skip` + other improvements (#14278)
* `nim doc --backend:js|cpp...`
`nim doc --doccmd:'-d:foo --threads:on'`
`nim r --backend:cpp...` (implies --run --usenimcache)
* --usenimcache works with all targets
* --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
Diffstat (limited to 'compiler/nim.nim')
-rw-r--r--compiler/nim.nim12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/nim.nim b/compiler/nim.nim
index dba5b8bc3..b48fce0b8 100644
--- a/compiler/nim.nim
+++ b/compiler/nim.nim
@@ -88,17 +88,19 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
       tccgen.run(conf, conf.arguments)
   if optRun in conf.globalOptions:
     let output = conf.absOutFile
-    let ex = quoteShell output
     case conf.cmd
-    of cmdCompileToJS:
-      execExternalProgram(conf, findNodeJs() & " " & ex & ' ' & conf.arguments)
+    of cmdCompileToBackend:
+      var cmdPrefix = ""
+      case conf.backend
+      of backendC, backendCpp, backendObjc: discard
+      of backendJs: cmdPrefix = findNodeJs() & " "
+      else: doAssert false, $conf.backend
+      execExternalProgram(conf, cmdPrefix & output.quoteShell & ' ' & conf.arguments)
     of cmdDoc, cmdRst2html:
       if conf.arguments.len > 0:
         # reserved for future use
         rawMessage(conf, errGenerated, "'$1 cannot handle arguments" % [$conf.cmd])
       openDefaultBrowser($output)
-    of cmdCompileToC, cmdCompileToCpp, cmdCompileToOC:
-      execExternalProgram(conf, ex & ' ' & conf.arguments)
     else:
       # support as needed
       rawMessage(conf, errGenerated, "'$1 cannot handle --run" % [$conf.cmd])