-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package types2 | ||
|
||
// An Array represents an array type. | ||
type Array struct { | ||
len int | ||
elem Type | ||
} | ||
|
||
// NewArray returns a new array type for the given element type and length. | ||
// A negative length indicates an unknown length. | ||
func NewArray(elem Type, len int) *Array { return &Array{len: len, elem: elem} } | ||
|
||
// Len returns the length of array a. | ||
// A negative result indicates an unknown length. | ||
func (a *Array) Len() int { return a.len } | ||
|
||
// Elem returns element type of array a. | ||
func (a *Array) Elem() Type { return a.elem } | ||
|
||
func (t *Array) Underlying() Type { return t } | ||
func (t *Array) String() string { return "@TBI" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters