Source file src/go/types/array.go

     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  // An Array represents an array type.
    10  type Array struct {
    11  	len  int64
    12  	elem Type
    13  }
    14  
    15  // NewArray returns a new array type for the given element type and length.
    16  // A negative length indicates an unknown length.
    17  func NewArray(elem Type, len int64) *Array { return &Array{len: len, elem: elem} }
    18  
    19  // Len returns the length of array a.
    20  // A negative result indicates an unknown length.
    21  func (a *Array) Len() int64 { return a.len }
    22  
    23  // Elem returns element type of array a.
    24  func (a *Array) Elem() Type { return a.elem }
    25  
    26  func (a *Array) Underlying() Type { return a }
    27  func (a *Array) String() string   { return TypeString(a, nil) }
    28  

View as plain text