Source file src/cmd/compile/internal/types2/pointer.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 Pointer represents a pointer type.
     8  type Pointer struct {
     9  	base Type // element type
    10  }
    11  
    12  // NewPointer returns a new pointer type for the given element (base) type.
    13  func NewPointer(elem Type) *Pointer { return &Pointer{base: elem} }
    14  
    15  // Elem returns the element type for the given pointer p.
    16  func (p *Pointer) Elem() Type { return p.base }
    17  
    18  func (p *Pointer) Underlying() Type { return p }
    19  func (p *Pointer) String() string   { return TypeString(p, nil) }
    20  

View as plain text