Source file src/go/types/pointer.go
1 // Code generated by "go test -run=Generate -write=all"; DO NOT EDIT. 2 // Source: ../../cmd/compile/internal/types2/pointer.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 Pointer represents a pointer type. 11 type Pointer struct { 12 base Type // element type 13 } 14 15 // NewPointer returns a new pointer type for the given element (base) type. 16 func NewPointer(elem Type) *Pointer { return &Pointer{base: elem} } 17 18 // Elem returns the element type for the given pointer p. 19 func (p *Pointer) Elem() Type { return p.base } 20 21 func (p *Pointer) Underlying() Type { return p } 22 func (p *Pointer) String() string { return TypeString(p, nil) } 23