Source file src/go/types/map.go
1 // Code generated by "go test -run=Generate -write=all"; DO NOT EDIT. 2 // Source: ../../cmd/compile/internal/types2/map.go 3 4 // Copyright 2011 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 package types 9 10 // A Map represents a map type. 11 type Map struct { 12 key, elem Type 13 } 14 15 // NewMap returns a new map for the given key and element types. 16 func NewMap(key, elem Type) *Map { 17 return &Map{key: key, elem: elem} 18 } 19 20 // Key returns the key type of map m. 21 func (m *Map) Key() Type { return m.key } 22 23 // Elem returns the element type of map m. 24 func (m *Map) Elem() Type { return m.elem } 25 26 func (t *Map) Underlying() Type { return t } 27 func (t *Map) String() string { return TypeString(t, nil) } 28