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->hiter != T) {
- t = t->hiter;
- return fmtprint(fp, "map.iter[%T]%T", t->down, t->type);
+ if(t->map != T) {
+ if(t->map->bucket == t) {
+ return fmtprint(fp, "map.bucket[%T]%T", t->map->down, t->map->type);
+ }
+ if(t->map->hmap == t) {
+ return fmtprint(fp, "map.hdr[%T]%T", t->map->down, t->map->type);
+ }
+ if(t->map->hiter == t) {
+ return fmtprint(fp, "map.iter[%T]%T", t->map->down, t->map->type);
+ }
+ yyerror("unknown internal map type");
}
if(t->funarg) {
Type* bucket; // internal type representing a hash bucket
Type* hmap; // internal type representing a Hmap (map header object)
Type* hiter; // internal type representing hash iterator state
+ Type* map; // link from the above 3 internal types back to the map type.
int32 maplineno; // first use of TFORW as map key
int32 embedlineno; // first use of TFORW as embedded type
bucket->width = offset;
bucket->local = t->local;
t->bucket = bucket;
+ bucket->map = t;
return bucket;
}
h->width = offset;
h->local = t->local;
t->hmap = h;
- h->hmap = t;
+ h->map = t;
return h;
}
if(off != 11 * widthptr)
yyerror("hash_iter size not correct %d %d", off, 11 * widthptr);
t->hiter = i;
- i->hiter = t;
+ i->map = t;
return i;
}