Source file src/go/types/array.go

     1  // Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
     2  // Source: ../../cmd/compile/internal/types2/array.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  // An Array represents an array type.
    11  type Array struct {
    12  	len  int64
    13  	elem Type
    14  }
    15  
    16  // NewArray returns a new array type for the given element type and length.
    17  // A negative length indicates an unknown length.
    18  func NewArray(elem Type, len int64) *Array { return &Array{len: len, elem: elem} }
    19  
    20  // Len returns the length of array a.
    21  // A negative result indicates an unknown length.
    22  func (a *Array) Len() int64 { return a.len }
    23  
    24  // Elem returns element type of array a.
    25  func (a *Array) Elem() Type { return a.elem }
    26  
    27  func (a *Array) Underlying() Type { return a }
    28  func (a *Array) String() string   { return TypeString(a, nil) }
    29  

View as plain text