diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-02-01 15:39:56 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-02-01 23:39:40 +0100 |
commit | f04d21f2793933f9b9a54ef2d67dc277e53a0c67 (patch) | |
tree | c51450738683304898e24a3065e4e9898a43c86e /tools | |
parent | 5565b9ef10f5022ea1bdf84fd40c1bca4a6e02e8 (diff) | |
download | Nim-f04d21f2793933f9b9a54ef2d67dc277e53a0c67.tar.gz |
refactoring: explict config state instead of globals
Diffstat (limited to 'tools')
-rw-r--r-- | tools/nimsuggest/nimsuggest.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/nimsuggest/nimsuggest.nim b/tools/nimsuggest/nimsuggest.nim index b5e7b282f..78fc3fd52 100644 --- a/tools/nimsuggest/nimsuggest.nim +++ b/tools/nimsuggest/nimsuggest.nim @@ -418,7 +418,7 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string) = options.gProjectName = unixToNativePath(p.key) # if processArgument(pass, p, argsCount): break -proc handleCmdLine(cache: IdentCache) = +proc handleCmdLine(cache: IdentCache; config: ConfigRef) = if paramCount() == 0: stdout.writeline(Usage) else: @@ -444,23 +444,23 @@ proc handleCmdLine(cache: IdentCache) = gPrefixDir = binaryPath.splitPath().head.parentDir() #msgs.writelnHook = proc (line: string) = logStr(line) - loadConfigs(DefaultConfig, cache) # load all config files + loadConfigs(DefaultConfig, cache, config) # load all config files # now process command line arguments again, because some options in the # command line can overwite the config file's settings options.command = "nimsuggest" let scriptFile = gProjectFull.changeFileExt("nims") if fileExists(scriptFile): - runNimScript(cache, scriptFile, freshDefines=false) + runNimScript(cache, scriptFile, freshDefines=false, config) # 'nim foo.nims' means to just run the NimScript file and do nothing more: if scriptFile == gProjectFull: return elif fileExists(gProjectPath / "config.nims"): # directory wide NimScript file - runNimScript(cache, gProjectPath / "config.nims", freshDefines=false) + runNimScript(cache, gProjectPath / "config.nims", freshDefines=false, config) extccomp.initVars() processCmdLine(passCmd2, "") - let graph = newModuleGraph() + let graph = newModuleGraph(config) graph.suggestMode = true mainCommand(graph, cache) @@ -472,4 +472,4 @@ when false: condsyms.initDefines() defineSymbol "nimsuggest" -handleCmdline(newIdentCache()) +handleCmdline(newIdentCache(), newConfigRef()) |