mirror of
https://github.com/golang/go
synced 2024-11-18 05:04:47 -07:00
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 <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
b8fe9f7970
commit
c1b7f508b0
@ -6,6 +6,7 @@ package gc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cmd/compile/internal/types"
|
"cmd/compile/internal/types"
|
||||||
|
"cmd/internal/src"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -425,7 +426,14 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if n.Pos.IsKnown() {
|
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 {
|
if c == 0 && n.Xoffset != BADWIDTH {
|
||||||
|
Loading…
Reference in New Issue
Block a user