...

Source file src/go/types/array.go

Documentation: go/types

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

View as plain text