Source file src/cmd/compile/internal/types2/map.go

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

View as plain text