* fix #16334 * rename isstdout -> isStdout * separate lastMsgWasDot for stdout and stderr * simplify logic
This commit is contained in:
parent
5e8e948ffc
commit
b6443c96a0
2 changed files with 14 additions and 6 deletions
|
|
@ -16,11 +16,15 @@ import strutils2
|
||||||
type InstantiationInfo* = typeof(instantiationInfo())
|
type InstantiationInfo* = typeof(instantiationInfo())
|
||||||
template instLoc(): InstantiationInfo = instantiationInfo(-2, fullPaths = true)
|
template instLoc(): InstantiationInfo = instantiationInfo(-2, fullPaths = true)
|
||||||
|
|
||||||
template flushDot(conf, stdorr) =
|
template toStdOrrKind(stdOrr): untyped =
|
||||||
|
if stdOrr == stdout: stdOrrStdout else: stdOrrStderr
|
||||||
|
|
||||||
|
template flushDot(conf, stdOrr) =
|
||||||
## safe to call multiple times
|
## safe to call multiple times
|
||||||
if conf.lastMsgWasDot:
|
let stdOrrKind = stdOrr.toStdOrrKind()
|
||||||
conf.lastMsgWasDot = false
|
if stdOrrKind in conf.lastMsgWasDot:
|
||||||
write(stdorr, "\n")
|
conf.lastMsgWasDot.excl stdOrrKind
|
||||||
|
write(stdOrr, "\n")
|
||||||
|
|
||||||
proc toCChar*(c: char; result: var string) =
|
proc toCChar*(c: char; result: var string) =
|
||||||
case c
|
case c
|
||||||
|
|
@ -357,7 +361,7 @@ proc msgWrite(conf: ConfigRef; s: string) =
|
||||||
stderr
|
stderr
|
||||||
write(stdOrr, s)
|
write(stdOrr, s)
|
||||||
flushFile(stdOrr)
|
flushFile(stdOrr)
|
||||||
conf.lastMsgWasDot = true # subsequent writes need `flushDot`
|
conf.lastMsgWasDot.incl stdOrr.toStdOrrKind() # subsequent writes need `flushDot`
|
||||||
|
|
||||||
template styledMsgWriteln*(args: varargs[typed]) =
|
template styledMsgWriteln*(args: varargs[typed]) =
|
||||||
if not isNil(conf.writelnHook):
|
if not isNil(conf.writelnHook):
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,10 @@ type
|
||||||
ProfileData* = ref object
|
ProfileData* = ref object
|
||||||
data*: TableRef[TLineInfo, ProfileInfo]
|
data*: TableRef[TLineInfo, ProfileInfo]
|
||||||
|
|
||||||
|
StdOrrKind* = enum
|
||||||
|
stdOrrStdout
|
||||||
|
stdOrrStderr
|
||||||
|
|
||||||
ConfigRef* = ref object ## every global configuration
|
ConfigRef* = ref object ## every global configuration
|
||||||
## fields marked with '*' are subject to
|
## fields marked with '*' are subject to
|
||||||
## the incremental compilation mechanisms
|
## the incremental compilation mechanisms
|
||||||
|
|
@ -304,7 +308,7 @@ type
|
||||||
projectPath*: AbsoluteDir # holds a path like /home/alice/projects/nim/compiler/
|
projectPath*: AbsoluteDir # holds a path like /home/alice/projects/nim/compiler/
|
||||||
projectFull*: AbsoluteFile # projectPath/projectName
|
projectFull*: AbsoluteFile # projectPath/projectName
|
||||||
projectIsStdin*: bool # whether we're compiling from stdin
|
projectIsStdin*: bool # whether we're compiling from stdin
|
||||||
lastMsgWasDot*: bool # the last compiler message was a single '.'
|
lastMsgWasDot*: set[StdOrrKind] # the last compiler message was a single '.'
|
||||||
projectMainIdx*: FileIndex # the canonical path id of the main module
|
projectMainIdx*: FileIndex # the canonical path id of the main module
|
||||||
projectMainIdx2*: FileIndex # consider merging with projectMainIdx
|
projectMainIdx2*: FileIndex # consider merging with projectMainIdx
|
||||||
command*: string # the main command (e.g. cc, check, scan, etc)
|
command*: string # the main command (e.g. cc, check, scan, etc)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue