feat: node refactor (#1316)

* refactor: node reader interface

* refactor: rewrite Taskfile() as anon recursive func

* chore: NewNodeFromIncludedTaskfile

* chore: changelog
This commit is contained in:
Pete Davison
2023-09-02 15:24:01 -05:00
committed by GitHub
parent b2e6c93b4b
commit afe8a618fe
7 changed files with 286 additions and 194 deletions

View File

@@ -0,0 +1,18 @@
package read
// BaseNode is a generic node that implements the Parent() and Optional()
// methods of the NodeReader interface. It does not implement the Read() method
// and it designed to be embedded in other node types so that this boilerplate
// code does not need to be repeated.
type BaseNode struct {
parent Node
optional bool
}
func (node *BaseNode) Parent() Node {
return node.parent
}
func (node *BaseNode) Optional() bool {
return node.optional
}