From: David Chase Date: Thu, 3 Oct 2019 16:15:14 +0000 (-0400) Subject: cmd/compile: modify line number printing for nodes X-Git-Tag: go1.14beta1~852 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c1b7f508b0f4db605bfae4216f421bc3ec00de75;p=gostls13.git cmd/compile: modify line number printing for nodes add preceding "+" for a line that is certainly a statement, and "_" for a line this is certainly not a statement. Change-Id: I831435dbc2302f25db1320b99d3513fe61fe1fa2 Reviewed-on: https://go-review.googlesource.com/c/go/+/198737 Run-TryBot: David Chase TryBot-Result: Gobot Gobot Reviewed-by: Jeremy Faller --- diff --git a/src/cmd/compile/internal/gc/fmt.go b/src/cmd/compile/internal/gc/fmt.go index 3bb2df9917..87e0e40dca 100644 --- a/src/cmd/compile/internal/gc/fmt.go +++ b/src/cmd/compile/internal/gc/fmt.go @@ -6,6 +6,7 @@ package gc import ( "cmd/compile/internal/types" + "cmd/internal/src" "fmt" "io" "strconv" @@ -425,7 +426,14 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) { } if n.Pos.IsKnown() { - fmt.Fprintf(s, " l(%d)", n.Pos.Line()) + pfx := "" + switch n.Pos.IsStmt() { + case src.PosNotStmt: + pfx = "_" // "-" would be confusing + case src.PosIsStmt: + pfx = "+" + } + fmt.Fprintf(s, " l(%s%d)", pfx, n.Pos.Line()) } if c == 0 && n.Xoffset != BADWIDTH {