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