]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type
authorRuss Cox <rsc@golang.org>
Fri, 17 Apr 2015 15:56:29 +0000 (11:56 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 17 Apr 2015 19:29:15 +0000 (19:29 +0000)
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>
src/cmd/internal/gc/fmt.go
src/cmd/internal/gc/mparith2.go
src/cmd/internal/gc/mparith3.go

index ff5dc5e909d5f6b741ab494f3a92de57bb468231..5d1990e48c114ff1e257ea27faef9f82d0b641ff 100644 (file)
@@ -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 {
index e369ad064fc077cdbf3c13daaa4434f68bce1689..de96e97809a7230ae9cbe415e201ceb19be95de2 100644 (file)
@@ -288,6 +288,10 @@ func mpatofix(a *Mpint, as string) {
        }
 }
 
+func (x *Mpint) String() string {
+       return Bconv(x, 0)
+}
+
 func Bconv(xval *Mpint, flag int) string {
        if flag&obj.FmtSharp != 0 {
                return fmt.Sprintf("%#x", &xval.Val)
index 88ab0e74135fd34e70e1af0bdf8781cece0d1886..53ab9c63a094a6486a88a471c3a3ad1e6cfe5f9d 100644 (file)
@@ -184,6 +184,10 @@ func mpatoflt(a *Mpflt, as string) {
        }
 }
 
+func (f *Mpflt) String() string {
+       return Fconv(f, 0)
+}
+
 func Fconv(fvp *Mpflt, flag int) string {
        if flag&obj.FmtSharp == 0 {
                return fvp.Val.Format('b', 0)