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 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. // If it defines no new members, it returns zero.
func (what Type) MembersLength () (length int) { func (section TypeSection) MembersLength () (length int) {
length = len(what.members) length = len(section.members)
return return
} }
// Member returns the member at index. // Member returns the member at index.
func (what Type) Member (index int) (member TypeMember) { func (section TypeSection) Member (index int) (member TypeSectionMember) {
member = what.members[index] member = section.members[index]
return return
} }
// BitWidth returns the bit width of the type member. If it is zero, it should // BitWidth returns the bit width of the type member. If it is zero, it should
// be treated as unspecified. // be treated as unspecified.
func (member TypeMember) BitWidth () (width uint64) { func (member TypeSectionMember) BitWidth () (width uint64) {
width = member.bitWidth width = member.bitWidth
return return
} }

View File

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