cmd/compile: refactor around HTMLWriter removing logger in favor of Func

Replace HTMLWriter's Logger field with a *Func. Implement Fatalf method
for HTMLWriter which gets the Frontend() from the Func and calls down
into it's Fatalf method, passing the msg and args along. Replace
remaining calls to the old Logger with calls to logging methods on
the Func.

Change-Id: I966342ef9997396f3416fb152fa52d60080ebecb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227277
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Bradford Lamson-Scribner 2020-04-05 12:44:02 -06:00 committed by Josh Bleecher Snyder
parent 656f27ebf8
commit 6736b2fdb2
3 changed files with 35 additions and 20 deletions

View file

@ -55,7 +55,7 @@ func Compile(f *Func) {
if f.Log() {
printFunc(f)
}
f.HTMLWriter.WriteFunc("start", "start", f)
f.HTMLWriter.WritePhase("start", "start")
if BuildDump != "" && BuildDump == f.Name {
f.dumpFile("build")
}
@ -111,7 +111,7 @@ func Compile(f *Func) {
f.Logf(" pass %s end %s\n", p.name, stats)
printFunc(f)
}
f.HTMLWriter.WriteFunc(phaseName, fmt.Sprintf("%s <span class=\"stats\">%s</span>", phaseName, stats), f)
f.HTMLWriter.WritePhase(phaseName, fmt.Sprintf("%s <span class=\"stats\">%s</span>", phaseName, stats))
}
if p.time || p.mem {
// Surround timing information w/ enough context to allow comparisons.