Added accessors to Argument and ObjtMember

This commit is contained in:
Sasha Koshka 2022-09-05 01:05:03 -04:00
parent 319ed789bf
commit 88de6f0908
1 changed files with 20 additions and 0 deletions

View File

@ -121,3 +121,23 @@ func (values ArrayInitializationValues) Value (index int) (value Argument) {
value = values.values[index]
return
}
// Kind returns what kind of argument it is.
func (argument Argument) Kind () (kind ArgumentKind) {
kind = argument.kind
return
}
// Value returns the underlying value of the argument. You can use Kind() to
// find out what to cast this to.
func (argument Argument) Value () (value any) {
value = argument.value
return
}
// BitWidth returns the bit width of the object member. If it is zero, it should
// be treated as unspecified.
func (member ObjtMember) BitWidth () (width uint64) {
width = member.bitWidth
return
}