Renamed method recievers from trait to node in node-traits

This commit is contained in:
Sasha Koshka 2022-09-27 14:18:46 -04:00
parent 873d6c89b1
commit 48325e224b

View File

@ -10,19 +10,19 @@ type locatable struct {
} }
// Location returns the location of the node. // Location returns the location of the node.
func (trait locatable) Location () (location file.Location) { func (node locatable) Location () (location file.Location) {
location = trait.location location = node.location
return return
} }
// NewError creates a new error at the node's location. // NewError creates a new error at the node's location.
func (trait locatable) NewError ( func (node locatable) NewError (
message string, message string,
kind infoerr.ErrorKind, kind infoerr.ErrorKind,
) ( ) (
err error, err error,
) { ) {
err = infoerr.NewError(trait.location, message, kind) err = infoerr.NewError(node.location, message, kind)
return return
} }
@ -32,8 +32,8 @@ type nameable struct {
} }
// Name returns the name of the node. // Name returns the name of the node.
func (trait nameable) Name () (name string) { func (node nameable) Name () (name string) {
name = trait.name name = node.name
return return
} }
// typeable allows a node to have a type. // typeable allows a node to have a type.
@ -42,8 +42,8 @@ type typeable struct {
} }
// Type returns the type of the node. // Type returns the type of the node.
func (trait typeable) Type () (what Type) { func (node typeable) Type () (what Type) {
what = trait.what what = node.what
return return
} }
@ -53,8 +53,8 @@ type permissionable struct {
} }
// Permission returns the permision of the node. // Permission returns the permision of the node.
func (trait permissionable) Permission () (permission types.Permission) { func (node permissionable) Permission () (permission types.Permission) {
permission = trait.permission permission = node.permission
return return
} }
@ -64,8 +64,8 @@ type valuable struct {
} }
// Value returns the value argument of the node. // Value returns the value argument of the node.
func (trait valuable) Value () (value Argument) { func (node valuable) Value () (value Argument) {
value = trait.value value = node.value
return return
} }
@ -75,13 +75,13 @@ type multiValuable struct {
} }
// Value returns the value at index. // Value returns the value at index.
func (trait multiValuable) Value (index int) (value Argument) { func (node multiValuable) Value (index int) (value Argument) {
value = trait.values[index] value = node.values[index]
return return
} }
// Length returns the amount of values in the mode. // Length returns the amount of values in the mode.
func (trait multiValuable) Length () (length int) { func (node multiValuable) Length () (length int) {
length = len(trait.values) length = len(node.values)
return return
} }