diff options
author | Robert Griesemer <gri@golang.org> | 2021-06-30 13:26:11 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-07-01 22:17:50 +0000 |
commit | 30e5f266ed202740cfe0b7a9fde6117d6e1d6064 (patch) | |
tree | a9e72b80ccad4eee8d3927b3ddf6e3d8906f0624 /src/cmd/compile/internal/types2/map.go | |
parent | 9c1e7d9eff564df532c31114e2b833752519f0a2 (diff) | |
download | go-30e5f266ed202740cfe0b7a9fde6117d6e1d6064.tar.gz go-30e5f266ed202740cfe0b7a9fde6117d6e1d6064.zip |
[dev.typeparams] cmd/compile/internal/types2: move (remaining) type decls into their own files (cleanup)
This change moves the type declarations and associated methods for
each of the remaining Type types into their respective files. Except
for import and comment adjustments, and receiver name adjustments for
the Underlying and String methods, no functional changes are made.
Change-Id: I3b9ccab3c85abea4852bacd28c2e47cec05c0bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/332093
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/map.go')
-rw-r--r-- | src/cmd/compile/internal/types2/map.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/map.go b/src/cmd/compile/internal/types2/map.go new file mode 100644 index 0000000000..0d3464caae --- /dev/null +++ b/src/cmd/compile/internal/types2/map.go @@ -0,0 +1,24 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package types2 + +// A Map represents a map type. +type Map struct { + key, elem Type +} + +// NewMap returns a new map for the given key and element types. +func NewMap(key, elem Type) *Map { + return &Map{key: key, elem: elem} +} + +// Key returns the key type of map m. +func (m *Map) Key() Type { return m.key } + +// Elem returns the element type of map m. +func (m *Map) Elem() Type { return m.elem } + +func (t *Map) Underlying() Type { return t } +func (t *Map) String() string { return TypeString(t, nil) } |