Added accessors for ObjtSection and EnumSection

This commit is contained in:
Sasha Koshka 2022-09-05 01:09:29 -04:00
parent 88de6f0908
commit bc4b2bd33c
2 changed files with 28 additions and 4 deletions

View File

@ -102,7 +102,7 @@ func (what Type) Points () (points Type) {
return
}
// Values returns an iterator for the initialization values
// Values returns an iterator for the initialization values.
func (values ObjectInitializationValues) Sections () (
iterator types.Iterator[Argument],
) {
@ -110,13 +110,13 @@ func (values ObjectInitializationValues) Sections () (
return
}
// Length returns the amount of values
// Length returns the amount of values.
func (values ArrayInitializationValues) Length () (length int) {
length = len(values.values)
return
}
// Item returns the value at index
// Item returns the value at index.
func (values ArrayInitializationValues) Value (index int) (value Argument) {
value = values.values[index]
return
@ -141,3 +141,27 @@ func (member ObjtMember) BitWidth () (width uint64) {
width = member.bitWidth
return
}
// Length returns the amount of members in the section.
func (section ObjtSection) Length () (length int) {
length = len(section.members)
return
}
// Item returns the member at index.
func (section ObjtSection) Item (index int) (member ObjtMember) {
member = section.members[index]
return
}
// Length returns the amount of members in the section.
func (section EnumSection) Length () (length int) {
length = len(section.members)
return
}
// Item returns the member at index.
func (section EnumSection) Item (index int) (member EnumMember) {
member = section.members[index]
return
}

View File

@ -193,7 +193,7 @@ type ObjtMember struct {
permissionable
valuable
bitWidth uint64
bitWidth uint64
}
// ObjtSection represents an object type definition.