This commit is contained in:
Araq 2018-12-14 09:56:59 +01:00
commit f551b72fba
2 changed files with 92 additions and 13 deletions

View file

@ -48,18 +48,26 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
if self.suggestMode:
conf.command = "nimsuggest"
# These defines/options should not be enabled while processing nimscript
# bug #4446, #9420, #8991, #9589, #9153
undefSymbol(conf.symbols, "profiler")
undefSymbol(conf.symbols, "memProfiler")
undefSymbol(conf.symbols, "nodejs")
when false:
# These defines/options should not be enabled while processing nimscript
# bug #4446, #9420, #8991, #9589, #9153
undefSymbol(conf.symbols, "profiler")
undefSymbol(conf.symbols, "memProfiler")
undefSymbol(conf.symbols, "nodejs")
# bug #9120
conf.globalOptions.excl(optTaintMode)
# bug #9120
conf.globalOptions.excl(optTaintMode)
proc runNimScriptIfExists(path: AbsoluteFile)=
if fileExists(path):
runNimScript(cache, path, freshDefines = false, conf)
template runNimScriptIfExists(path: AbsoluteFile) =
let p = path # eval once
if fileExists(p):
var tempConf = newConfigRef()
setDefaultLibpath(tempConf)
initDefines(tempConf.symbols)
tempConf.command = conf.command
tempConf.commandArgs = conf.commandArgs
runNimScript(cache, p, freshDefines = false, tempConf)
mergeConfigs(conf, tempConf)
# Caution: make sure this stays in sync with `loadConfigs`
if optSkipSystemConfigFile notin conf.globalOptions:
@ -88,9 +96,6 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
# 'nimsuggest foo.nims' means to just auto-complete the NimScript file
discard
# Reload configuration from .cfg file
loadConfigs(DefaultConfig, cache, conf)
# now process command line arguments again, because some options in the
# command line can overwite the config file's settings
extccomp.initVars(conf)