remove isCmdLine; use passCmd1

This commit is contained in:
Timothee Cour 2020-02-26 03:10:11 -08:00 • committed by Andreas Rumpf
commit c1cbf94e2d
4 changed files with 3 additions and 7 deletions

View file

@ -27,9 +27,7 @@ proc initDefinesProg*(self: NimProg, conf: ConfigRef, name: string) =
defineSymbol conf.symbols, name defineSymbol conf.symbols, name
proc processCmdLineAndProjectPath*(self: NimProg, conf: ConfigRef) = proc processCmdLineAndProjectPath*(self: NimProg, conf: ConfigRef) =
conf.isCmdLine = true
self.processCmdLine(passCmd1, "", conf) self.processCmdLine(passCmd1, "", conf)
conf.isCmdLine = false
if self.supportsStdinFile and conf.projectName == "-": if self.supportsStdinFile and conf.projectName == "-":
handleStdinInput(conf) handleStdinInput(conf)
elif conf.projectName != "": elif conf.projectName != "":

View file

@ -204,7 +204,7 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
incl(conf.notes, n) incl(conf.notes, n)
incl(conf.mainPackageNotes, n) incl(conf.mainPackageNotes, n)
incl(conf.enableNotes, n) incl(conf.enableNotes, n)
if conf.isCmdLine: if pass == passCmd1:
incl(conf.cmdLineNotes, n) incl(conf.cmdLineNotes, n)
excl(conf.cmdLineDisabledNotes, n) excl(conf.cmdLineDisabledNotes, n)
of "off": of "off":
@ -212,7 +212,7 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
excl(conf.mainPackageNotes, n) excl(conf.mainPackageNotes, n)
incl(conf.disableNotes, n) incl(conf.disableNotes, n)
excl(conf.foreignPackageNotes, n) excl(conf.foreignPackageNotes, n)
if conf.isCmdLine: if pass == passCmd1:
incl(conf.cmdLineDisabledNotes, n) incl(conf.cmdLineDisabledNotes, n)
excl(conf.cmdLineNotes, n) excl(conf.cmdLineNotes, n)
else: localError(conf, info, errOnOrOffExpectedButXFound % arg) else: localError(conf, info, errOnOrOffExpectedButXFound % arg)

View file

@ -421,7 +421,7 @@ proc rawMessage*(conf: ConfigRef; msg: TMsgKind, args: openArray[string]) =
if msg in conf.cmdLineDisabledNotes: return # eg: `--hints:conf:off` passed on cmdline if msg in conf.cmdLineDisabledNotes: return # eg: `--hints:conf:off` passed on cmdline
# handle `--hints:off` (regardless of cmdline/cfg file) # handle `--hints:off` (regardless of cmdline/cfg file)
# handle `--hints:conf:on` on cmdline # handle `--hints:conf:on` on cmdline
if not conf.hasHint(msg) and not (optHints in conf.options and msg in conf.cmdLineNotes)): return if not conf.hasHint(msg) and not (optHints in conf.options and msg in conf.cmdLineNotes): return
title = HintTitle title = HintTitle
color = HintColor color = HintColor
if msg != hintUserRaw: kind = HintsToStr[ord(msg) - ord(hintMin)] if msg != hintUserRaw: kind = HintsToStr[ord(msg) - ord(hintMin)]

View file

@ -288,7 +288,6 @@ type
structuredErrorHook*: proc (config: ConfigRef; info: TLineInfo; msg: string; structuredErrorHook*: proc (config: ConfigRef; info: TLineInfo; msg: string;
severity: Severity) {.closure, gcsafe.} severity: Severity) {.closure, gcsafe.}
cppCustomNamespace*: string cppCustomNamespace*: string
isCmdLine*: bool # whether we are currently processing cmdline args, not cfg files
proc hasHint*(conf: ConfigRef, note: TNoteKind): bool = proc hasHint*(conf: ConfigRef, note: TNoteKind): bool =
optHints in conf.options and note in conf.notes optHints in conf.options and note in conf.notes
@ -394,7 +393,6 @@ proc newConfigRef*(): ConfigRef =
arguments: "", arguments: "",
suggestMaxResults: 10_000, suggestMaxResults: 10_000,
maxLoopIterationsVM: 10_000_000, maxLoopIterationsVM: 10_000_000,
isCmdLine: false,
) )
setTargetFromSystem(result.target) setTargetFromSystem(result.target)
# enable colors by default on terminals # enable colors by default on terminals