50 lines
772 B
Go
50 lines
772 B
Go
package stmt
|
|
|
|
import (
|
|
"github.com/z7zmey/php-parser/node"
|
|
)
|
|
|
|
type TraitUse struct {
|
|
name string
|
|
traits []node.Node
|
|
adaptations []node.Node
|
|
}
|
|
|
|
func NewTraitUse(traits []node.Node, adaptations []node.Node) node.Node {
|
|
return TraitUse{
|
|
"TraitUse",
|
|
traits,
|
|
adaptations,
|
|
}
|
|
}
|
|
|
|
func (n TraitUse) Name() string {
|
|
return "TraitUse"
|
|
}
|
|
|
|
func (n TraitUse) Attributes() map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
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)
|
|
}
|