Commit f8fb95f2 authored by Alan Donovan's avatar Alan Donovan

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
parent 3c25cd27
......@@ -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) }
......@@ -8,6 +8,7 @@ import "go/ast"
// All types implement the Type interface.
type Type interface {
String() string
aType()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment