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) Attribute(key string) interface{} { return n.attributes[key] } func (n TraitUse) SetAttribute(key string, value interface{}) node.Node { n.attributes[key] = value return n } 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) }