57 lines
948 B
Go
57 lines
948 B
Go
package stmt
|
|
|
|
import (
|
|
"github.com/z7zmey/php-parser/node"
|
|
)
|
|
|
|
type TraitUse struct {
|
|
attributes map[string]interface{}
|
|
position *node.Position
|
|
traits []node.Node
|
|
adaptations []node.Node
|
|
}
|
|
|
|
func NewTraitUse(traits []node.Node, adaptations []node.Node) node.Node {
|
|
return &TraitUse{
|
|
map[string]interface{}{},
|
|
nil,
|
|
traits,
|
|
adaptations,
|
|
}
|
|
}
|
|
|
|
func (n TraitUse) Attributes() map[string]interface{} {
|
|
return n.attributes
|
|
}
|
|
|
|
func (n TraitUse) Position() *node.Position {
|
|
return n.position
|
|
}
|
|
|
|
func (n TraitUse) SetPosition(p *node.Position) node.Node {
|
|
n.position = p
|
|
return n
|
|
}
|
|
|
|
func (n TraitUse) Walk(v node.Visitor) {
|
|
if v.EnterNode(n) == false {
|
|
return
|
|
}
|
|
|
|
if n.traits != nil {
|
|
vv := v.GetChildrenVisitor("traits")
|
|
for _, nn := range n.traits {
|
|
nn.Walk(vv)
|
|
}
|
|
}
|
|
|
|
if n.adaptations != nil {
|
|
vv := v.GetChildrenVisitor("adaptations")
|
|
for _, nn := range n.adaptations {
|
|
nn.Walk(vv)
|
|
}
|
|
}
|
|
|
|
v.LeaveNode(n)
|
|
}
|