53 lines
912 B
Go
53 lines
912 B
Go
package stmt
|
|
|
|
import (
|
|
"github.com/z7zmey/php-parser/node"
|
|
)
|
|
|
|
// TraitUse node
|
|
type TraitUse struct {
|
|
Traits []node.Node
|
|
Adaptations []node.Node
|
|
}
|
|
|
|
// NewTraitUse node constuctor
|
|
func NewTraitUse(Traits []node.Node, Adaptations []node.Node) *TraitUse {
|
|
return &TraitUse{
|
|
Traits,
|
|
Adaptations,
|
|
}
|
|
}
|
|
|
|
// Attributes returns node attributes as map
|
|
func (n *TraitUse) Attributes() map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
// Walk traverses nodes
|
|
// Walk is invoked recursively until v.EnterNode returns true
|
|
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 {
|
|
if nn != nil {
|
|
nn.Walk(vv)
|
|
}
|
|
}
|
|
}
|
|
|
|
if n.Adaptations != nil {
|
|
vv := v.GetChildrenVisitor("Adaptations")
|
|
for _, nn := range n.Adaptations {
|
|
if nn != nil {
|
|
nn.Walk(vv)
|
|
}
|
|
}
|
|
}
|
|
|
|
v.LeaveNode(n)
|
|
}
|