diff options
author | WhiteDuke <Wh1teDuke@users.noreply.github.com> | 2018-06-04 13:31:22 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-04 13:31:22 +0200 |
commit | 59ba1e77afeddc172dbc09edc752c9725c8cfdf5 (patch) | |
tree | 665b340565202617985372ae3b91af7699bc6a56 /compiler | |
parent | 582786d0684b76a5bab5faa54304b2873bdcff5e (diff) | |
download | Nim-59ba1e77afeddc172dbc09edc752c9725c8cfdf5.tar.gz |
Wait until the end to print hint Conf (#7931)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/nimconf.nim | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index 6cb5bab0f..a455b4a44 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -201,7 +201,8 @@ proc parseAssignment(L: var TLexer, tok: var TToken; else: processSwitch(s, val, passPP, info, config) -proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) = +proc readConfigFile( + filename: string; cache: IdentCache; config: ConfigRef): bool = var L: TLexer tok: TToken @@ -216,7 +217,7 @@ proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) = while tok.tokType != tkEof: parseAssignment(L, tok, config, condStack) if len(condStack) > 0: lexMessage(L, errGenerated, "expected @end") closeLexer(L) - rawMessage(config, hintConf, filename) + return true proc getUserConfigPath(filename: string): string = result = joinPath(getConfigDir(), filename) @@ -232,27 +233,37 @@ proc getSystemConfigPath(conf: ConfigRef; filename: string): string = proc loadConfigs*(cfg: string; cache: IdentCache; conf: ConfigRef) = setDefaultLibpath(conf) + + var configFiles = newSeq[string]() + + template readConfigFile(path: string) = + let configPath = path + if readConfigFile(configPath, cache, conf): + add(configFiles, configPath) if optSkipConfigFile notin conf.globalOptions: - readConfigFile(getSystemConfigPath(conf, cfg), cache, conf) + readConfigFile(getSystemConfigPath(conf, cfg)) if optSkipUserConfigFile notin conf.globalOptions: - readConfigFile(getUserConfigPath(cfg), cache, conf) + readConfigFile(getUserConfigPath(cfg)) let pd = if conf.projectPath.len > 0: conf.projectPath else: getCurrentDir() if optSkipParentConfigFiles notin conf.globalOptions: for dir in parentDirs(pd, fromRoot=true, inclusive=false): - readConfigFile(dir / cfg, cache, conf) + readConfigFile(dir / cfg) if optSkipProjConfigFile notin conf.globalOptions: - readConfigFile(pd / cfg, cache, conf) + readConfigFile(pd / cfg) if conf.projectName.len != 0: # new project wide config file: var projectConfig = changeFileExt(conf.projectFull, "nimcfg") if not fileExists(projectConfig): projectConfig = changeFileExt(conf.projectFull, "nim.cfg") - readConfigFile(projectConfig, cache, conf) + readConfigFile(projectConfig) + + for filename in configFiles: + rawMessage(conf, hintConf, filename) proc loadConfigs*(cfg: string; conf: ConfigRef) = # for backwards compatibility only. |