1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:50:05 -07:00

go/types: add String() method to Type interface.

All implementations delegate to typeString.

Though I don't wish to exploit gri's absence to change
his code, this change is pretty low-risk and he assented to it
in the blue ink in the doc below [gophers only].
https://docs.google.com/a/google.com/document/d/1-DQ4fxlMDs9cYtnkKhAAehX6MArjOQyJsRXp-6kiJLA/edit#

R=iant, gri, gri
CC=golang-dev
https://golang.org/cl/7200046
This commit is contained in:
Alan Donovan 2013-01-24 14:21:51 -05:00
parent 3c25cd2784
commit f8fb95f288
2 changed files with 14 additions and 0 deletions

View File

@ -316,3 +316,16 @@ func writeType(buf *bytes.Buffer, typ Type) {
fmt.Fprintf(buf, "<type %T>", t)
}
}
func (t *Array) String() string { return typeString(t) }
func (t *Basic) String() string { return typeString(t) }
func (t *Chan) String() string { return typeString(t) }
func (t *Interface) String() string { return typeString(t) }
func (t *Map) String() string { return typeString(t) }
func (t *NamedType) String() string { return typeString(t) }
func (t *Pointer) String() string { return typeString(t) }
func (t *Result) String() string { return typeString(t) }
func (t *Signature) String() string { return typeString(t) }
func (t *Slice) String() string { return typeString(t) }
func (t *Struct) String() string { return typeString(t) }
func (t *builtin) String() string { return typeString(t) }

View File

@ -8,6 +8,7 @@ import "go/ast"
// All types implement the Type interface.
type Type interface {
String() string
aType()
}