Commit 0061e561 authored by Rob Pike's avatar Rob Pike

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
parent 79985fa5
...@@ -9,12 +9,12 @@ import ( ...@@ -9,12 +9,12 @@ import (
) )
func typedump(s string) { func typedump(s string) {
t := reflect.ParseTypeString(s); t := reflect.ParseTypeString("", s);
print(reflect.TypeToString(t),"; size = ", t.Size(), "\n"); print(reflect.TypeToString(t),"; size = ", t.Size(), "\n");
} }
func valuedump(s string) { func valuedump(s string) {
t := reflect.ParseTypeString(s); t := reflect.ParseTypeString("", s);
v := reflect.NewInitValue(t); v := reflect.NewInitValue(t);
switch v.Kind() { switch v.Kind() {
case reflect.Int8Kind: case reflect.Int8Kind:
......
...@@ -35,6 +35,9 @@ func TypeFieldsToString(t HasFields, sep string) string { ...@@ -35,6 +35,9 @@ func TypeFieldsToString(t HasFields, sep string) string {
func TypeToString(typ Type) string { func TypeToString(typ Type) string {
var str string; var str string;
if name := typ.Name(); name != "" {
return name
}
switch(typ.Kind()) { switch(typ.Kind()) {
case MissingKind: case MissingKind:
return "$missing$"; return "$missing$";
......
This diff is collapsed.
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