mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type
The next CL will remove unnecessary conv calls. Change-Id: I0e8dbd1756cdec1ef6095ae67629cd3fae0fb4a4 Reviewed-on: https://go-review.googlesource.com/9031 Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
8e5346571c
commit
96c91fa9db
3 changed files with 24 additions and 0 deletions
|
|
@ -1591,6 +1591,10 @@ func nodedump(n *Node, flag int) string {
|
|||
return buf.String()
|
||||
}
|
||||
|
||||
func (s *Sym) String() string {
|
||||
return Sconv(s, 0)
|
||||
}
|
||||
|
||||
// Fmt "%S": syms
|
||||
// Flags: "%hS" suppresses qualifying with package
|
||||
func Sconv(s *Sym, flag int) string {
|
||||
|
|
@ -1616,6 +1620,10 @@ func Sconv(s *Sym, flag int) string {
|
|||
return str
|
||||
}
|
||||
|
||||
func (t *Type) String() string {
|
||||
return Tconv(t, 0)
|
||||
}
|
||||
|
||||
// Fmt "%T": types.
|
||||
// Flags: 'l' print definition, not name
|
||||
// 'h' omit 'func' and receiver from function types, short type names
|
||||
|
|
@ -1654,6 +1662,10 @@ func Tconv(t *Type, flag int) string {
|
|||
return str
|
||||
}
|
||||
|
||||
func (n *Node) String() string {
|
||||
return Nconv(n, 0)
|
||||
}
|
||||
|
||||
// Fmt '%N': Nodes.
|
||||
// Flags: 'l' suffix with "(type %T)" where possible
|
||||
// '+h' in debug mode, don't recurse, no multiline output
|
||||
|
|
@ -1685,6 +1697,10 @@ func Nconv(n *Node, flag int) string {
|
|||
return str
|
||||
}
|
||||
|
||||
func (l *NodeList) String() string {
|
||||
return Hconv(l, 0)
|
||||
}
|
||||
|
||||
// Fmt '%H': NodeList.
|
||||
// Flags: all those of %N plus ',': separate with comma's instead of semicolons.
|
||||
func Hconv(l *NodeList, flag int) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue