diff options
author | Rob Pike <r@golang.org> | 2008-10-22 13:02:43 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2008-10-22 13:02:43 -0700 |
commit | 912fcfa05f3eaa977f69343b4b26d614ae663f38 (patch) | |
tree | 96f1ebdee12eee6f84069fcd920390a84ad1b4f7 /usr/r/reflect/tostring.go | |
parent | 95b924c54e591a064caad72ebd9f4149751fbe75 (diff) | |
download | golang-912fcfa05f3eaa977f69343b4b26d614ae663f38.tar.gz |
Add names to types to avoid recursive explosion and to get
the right answer when a type name redefines an existing type.
R=rsc
DELTA=133 (53 added, 8 deleted, 72 changed)
OCL=17637
CL=17639
Diffstat (limited to 'usr/r/reflect/tostring.go')
-rw-r--r-- | usr/r/reflect/tostring.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/usr/r/reflect/tostring.go b/usr/r/reflect/tostring.go index 17a0a79fc..f60013c00 100644 --- a/usr/r/reflect/tostring.go +++ b/usr/r/reflect/tostring.go @@ -35,6 +35,9 @@ func TypeFieldsToString(t HasFields, sep string) string { func TypeToString(typ Type) string { var str string; + if name := typ.Name(); name != "" { + return name + } switch(typ.Kind()) { case MissingKind: return "$missing$"; |