alter-fixed-array-syntax #3

Merged
sashakoshka merged 6 commits from alter-fixed-array-syntax into main 2022-09-05 09:39:27 -06:00
3 changed files with 5 additions and 9 deletions
Showing only changes of commit 98a88b71be - Show all commits

View File

@ -75,10 +75,11 @@ func (what Type) Mutable () (mutable bool) {
return
}
// Length returns the length of the type if the type is a fixed length array.
// Otherwise, it just returns zero.
// Length returns the length of the type. If it is greater than 1, that means
// the type is a fixed length array.
func (what Type) Length () (length uint64) {
if what.kind == TypeKindArray {
length = 1
if what.length > 1 {
length = what.length
}
return

View File

@ -80,7 +80,7 @@ func (what Type) ToString () (output string) {
output += "}"
}
if what.kind == TypeKindArray {
if what.length > 1 {
output += fmt.Sprint(":", what.length)
}

View File

@ -55,9 +55,6 @@ const (
// TypeKindPointer means it's a pointer
TypeKindPointer
// TypeKindArray means it's a fixed length array.
TypeKindArray
// TypeKindVariableArray means it's an array of variable length.
TypeKindVariableArray
)
@ -68,8 +65,6 @@ type Type struct {
mutable bool
kind TypeKind
// only applicable for fixed length arrays.
length uint64
// only applicable for basic.