Updated tree and accessor semantics
This commit is contained in:
parent
031907a6e0
commit
98a88b71be
@ -75,10 +75,11 @@ func (what Type) Mutable () (mutable bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Length returns the length of the type if the type is a fixed length array.
|
// Length returns the length of the type. If it is greater than 1, that means
|
||||||
// Otherwise, it just returns zero.
|
// the type is a fixed length array.
|
||||||
func (what Type) Length () (length uint64) {
|
func (what Type) Length () (length uint64) {
|
||||||
if what.kind == TypeKindArray {
|
length = 1
|
||||||
|
if what.length > 1 {
|
||||||
length = what.length
|
length = what.length
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -80,7 +80,7 @@ func (what Type) ToString () (output string) {
|
|||||||
output += "}"
|
output += "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if what.kind == TypeKindArray {
|
if what.length > 1 {
|
||||||
output += fmt.Sprint(":", what.length)
|
output += fmt.Sprint(":", what.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,9 +55,6 @@ const (
|
|||||||
// TypeKindPointer means it's a pointer
|
// TypeKindPointer means it's a pointer
|
||||||
TypeKindPointer
|
TypeKindPointer
|
||||||
|
|
||||||
// TypeKindArray means it's a fixed length array.
|
|
||||||
TypeKindArray
|
|
||||||
|
|
||||||
// TypeKindVariableArray means it's an array of variable length.
|
// TypeKindVariableArray means it's an array of variable length.
|
||||||
TypeKindVariableArray
|
TypeKindVariableArray
|
||||||
)
|
)
|
||||||
@ -68,8 +65,6 @@ type Type struct {
|
|||||||
|
|
||||||
mutable bool
|
mutable bool
|
||||||
kind TypeKind
|
kind TypeKind
|
||||||
|
|
||||||
// only applicable for fixed length arrays.
|
|
||||||
length uint64
|
length uint64
|
||||||
|
|
||||||
// only applicable for basic.
|
// only applicable for basic.
|
||||||
|
Reference in New Issue
Block a user