mirror of
https://github.com/golang/go.git
synced 2025-05-30 19:52:53 +00:00
cmd/gc: shorten name used for map bucket type
Before: type.struct { buckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; oldbuckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable } } After: type.map.bucket[string]*"".RangeTable This makes debugging maps a little nicer, and it takes up less space in the binary. R=golang-dev, r CC=golang-dev, khr https://golang.org/cl/15110044
This commit is contained in:
parent
66f49f78a5
commit
20f99ffa3e
@ -700,6 +700,13 @@ typefmt(Fmt *fp, Type *t)
|
||||
return 0;
|
||||
|
||||
case TSTRUCT:
|
||||
// Format the bucket struct for map[x]y as map.bucket[x]y.
|
||||
// This avoids a recursive print that generates very long names.
|
||||
if(t->hmap != T) {
|
||||
t = t->hmap;
|
||||
return fmtprint(fp, "map.bucket[%T]%T", t->down, t->type);
|
||||
}
|
||||
|
||||
if(t->funarg) {
|
||||
fmtstrcpy(fp, "(");
|
||||
if(fmtmode == FTypeId || fmtmode == FErr) { // no argument names on function signature, and no "noescape" tags
|
||||
|
@ -229,6 +229,7 @@ hmap(Type *t)
|
||||
h->width = offset;
|
||||
h->local = t->local;
|
||||
t->hmap = h;
|
||||
h->hmap = t;
|
||||
return h;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user