Put type members back where they were

This commit is contained in:
Sasha Koshka 2022-09-28 11:07:39 -04:00
parent 1bd886fea0
commit 58af5f3f15
2 changed files with 20 additions and 20 deletions

View File

@ -82,22 +82,22 @@ func (what Type) Points () (points Type) {
return
}
// MembersLength returns the amount of new members the type specifier defines.
// MembersLength returns the amount of new members the type section defines.
// If it defines no new members, it returns zero.
func (what Type) MembersLength () (length int) {
length = len(what.members)
func (section TypeSection) MembersLength () (length int) {
length = len(section.members)
return
}
// Member returns the member at index.
func (what Type) Member (index int) (member TypeMember) {
member = what.members[index]
func (section TypeSection) Member (index int) (member TypeSectionMember) {
member = section.members[index]
return
}
// BitWidth returns the bit width of the type member. If it is zero, it should
// be treated as unspecified.
func (member TypeMember) BitWidth () (width uint64) {
func (member TypeSectionMember) BitWidth () (width uint64) {
width = member.bitWidth
return
}

View File

@ -47,17 +47,6 @@ const (
TypeKindVariableArray
)
// TypeMember represents a member variable of a type specifier.
type TypeMember struct {
locatable
nameable
typeable
permissionable
valuable
bitWidth uint64
}
// Type represents a type specifier
type Type struct {
locatable
@ -71,9 +60,6 @@ type Type struct {
// not applicable for basic.
points *Type
// if non-nil, this type defines new members.
members []TypeMember
}
// Declaration represents a variable declaration.
@ -162,6 +148,17 @@ type DataSection struct {
external bool
}
// TypeSectionMember represents a member variable of a type section.
type TypeSectionMember struct {
locatable
nameable
typeable
permissionable
valuable
bitWidth uint64
}
// TypeSection represents a type definition.
type TypeSection struct {
locatable
@ -169,6 +166,9 @@ type TypeSection struct {
typeable
permissionable
valuable
// if non-nil, this type defines new members.
members []TypeSectionMember
}
// EnumMember represents a member of an enum section.