diff --git a/internal/types2/array.go b/internal/types2/array.go new file mode 100644 index 00000000..34f59d1b --- /dev/null +++ b/internal/types2/array.go @@ -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" } diff --git a/internal/types2/types.go b/internal/types2/types.go index 71213e6c..4d61af56 100644 --- a/internal/types2/types.go +++ b/internal/types2/types.go @@ -117,26 +117,6 @@ func (b *Basic) Name() string { return b.name } func (t *Basic) Underlying() Type { return t } func (b *Basic) String() string { return b.name } -// 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" } - type Slice struct { elem Type IsElps bool