summary refs log tree commit diff stats
path: root/compiler/nimconf.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nimconf.nim')
-rw-r--r--compiler/nimconf.nim21
1 files changed, 10 insertions, 11 deletions
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
index c3591a945..3e8c4d194 100644
--- a/compiler/nimconf.nim
+++ b/compiler/nimconf.nim
@@ -10,7 +10,7 @@
 # This module handles the reading of the config file.
 
 import
-  llstream, commands, os, strutils, msgs, lexer,
+  llstream, commands, os, strutils, msgs, lexer, ast,
   options, idents, wordrecg, strtabs, lineinfos, pathutils, scriptconfig
 
 # ---------------- configuration file parser -----------------------------
@@ -238,7 +238,7 @@ proc getSystemConfigPath*(conf: ConfigRef; filename: RelativeFile): AbsoluteFile
     if not fileExists(result): result = p / RelativeDir"etc/nim" / filename
     if not fileExists(result): result = AbsoluteDir"/etc/nim" / filename
 
-proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) =
+proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen: IdGenerator) =
   setDefaultLibpath(conf)
 
   var configFiles = newSeq[AbsoluteFile]()
@@ -252,7 +252,7 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) =
     let p = path # eval once
     if fileExists(p):
       configFiles.add(p)
-      runNimScript(cache, p, freshDefines = false, conf)
+      runNimScript(cache, p, idgen, freshDefines = false, conf)
 
   if optSkipSystemConfigFile notin conf.globalOptions:
     readConfigFile(getSystemConfigPath(conf, cfg))
@@ -291,13 +291,12 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) =
     # delayed to here so that `hintConf` is honored
     rawMessage(conf, hintConf, filename.string)
 
-  block:
-    let scriptFile = conf.projectFull.changeFileExt("nims")
-    if conf.command != "nimsuggest":
+  let scriptFile = conf.projectFull.changeFileExt("nims")
+  if conf.command != "nimsuggest":
+    runNimScriptIfExists(scriptFile)
+  else:
+    if scriptFile != conf.projectFull:
       runNimScriptIfExists(scriptFile)
     else:
-      if scriptFile != conf.projectFull:
-        runNimScriptIfExists(scriptFile)
-      else:
-        # 'nimsuggest foo.nims' means to just auto-complete the NimScript file
-        discard
+      # 'nimsuggest foo.nims' means to just auto-complete the NimScript file
+      discard