dumpexporttype(t.Results())
dumpexporttype(t.Params())
case TMAP:
- dumpexporttype(t.Type)
- dumpexporttype(t.Down) // key
+ dumpexporttype(t.Val())
+ dumpexporttype(t.Key())
case TARRAY, TCHAN, TPTR32, TPTR64:
dumpexporttype(t.Type)
}
Yyerror("invalid map key type %v", key)
}
- // will be resolved later.
case TANY:
+ // will be resolved later.
break
- // map[key] used during definition of key.
- // postpone check until key is fully defined.
- // if there are multiple uses of map[key]
- // before key is fully defined, the error
- // will only be printed for the first one.
- // good enough.
case TFORW:
+ // map[key] used during definition of key.
+ // postpone check until key is fully defined.
+ // if there are multiple uses of map[key]
+ // before key is fully defined, the error
+ // will only be printed for the first one.
+ // good enough.
if key.Maplineno == 0 {
key.Maplineno = lineno
}
}
}
- t := typ(TMAP)
- t.Down = key
- t.Type = val
- return t
+ return typMap(key, val)
}
// methcmp sorts by symbol, then by package path for unexported symbols.
return t
}
+// typMap returns a new map Type with key type k and element (aka value) type v.
+func typMap(k, v *Type) *Type {
+ t := typ(TMAP)
+ t.Down = k
+ t.Type = v
+ return t
+}
+
// typPtr returns a new pointer type pointing to t.
func typPtr(elem *Type) *Type {
t := typ(Tptr)