summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-01-08 13:36:03 +0100
committerGitHub <noreply@github.com>2021-01-08 13:36:03 +0100
commitadd1ccb6cb4ad4b444a5cfa3ef5573b0c1d47d09 (patch)
treebad751fcdf21b070ea7e0e5fe3d9a516300bf0bf
parent596da7f9a0d6303738d368e119e49461591bfe71 (diff)
downloadNim-add1ccb6cb4ad4b444a5cfa3ef5573b0c1d47d09.tar.gz
compiler: minor refactoring (#16633)
-rw-r--r--compiler/main.nim23
1 files changed, 11 insertions, 12 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 4c67aaea7..438f90ba6 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -211,18 +211,17 @@ proc mainCommand*(graph: ModuleGraph) =
       defineSymbol(conf.symbols, "nimdoc")
       body
 
-  block: ## command prepass
-    if conf.cmd == cmdCrun: conf.globalOptions.incl {optRun, optUseNimcache}
-    if conf.cmd notin cmdBackends + {cmdTcc}: customizeForBackend(backendC)
-    if conf.outDir.isEmpty:
-      # doc like commands can generate a lot of files (especially with --project)
-      # so by default should not end up in $PWD nor in $projectPath.
-      conf.outDir = block:
-        var ret = if optUseNimcache in conf.globalOptions: getNimcacheDir(conf)
-                  else: conf.projectPath
-        doAssert ret.string.isAbsolute # `AbsoluteDir` is not a real guarantee
-        if conf.cmd in cmdDocLike + {cmdRst2html, cmdRst2tex}: ret = ret / htmldocsDir
-        ret
+  ## command prepass
+  if conf.cmd == cmdCrun: conf.globalOptions.incl {optRun, optUseNimcache}
+  if conf.cmd notin cmdBackends + {cmdTcc}: customizeForBackend(backendC)
+  if conf.outDir.isEmpty:
+    # doc like commands can generate a lot of files (especially with --project)
+    # so by default should not end up in $PWD nor in $projectPath.
+    var ret = if optUseNimcache in conf.globalOptions: getNimcacheDir(conf)
+              else: conf.projectPath
+    doAssert ret.string.isAbsolute # `AbsoluteDir` is not a real guarantee
+    if conf.cmd in cmdDocLike + {cmdRst2html, cmdRst2tex}: ret = ret / htmldocsDir
+    conf.outDir = ret
 
   ## process all commands
   case conf.cmd