Skip to content

Commit

Permalink
Separate types file
Browse files Browse the repository at this point in the history
  • Loading branch information
DQNEO committed Aug 27, 2023
1 parent 917fac7 commit 992eadd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
21 changes: 21 additions & 0 deletions internal/types2/array.go
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" }
20 changes: 0 additions & 20 deletions internal/types2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 992eadd

Please sign in to comment.