php-parser/node/stmt/n_trait_use_precedence.go
2018-06-19 22:56:52 +03:00

52 lines
994 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/walker"
)
// TraitUsePrecedence node
type TraitUsePrecedence struct {
Ref node.Node
Insteadof []node.Node
}
// NewTraitUsePrecedence node constructor
func NewTraitUsePrecedence(Ref node.Node, Insteadof []node.Node) *TraitUsePrecedence {
return &TraitUsePrecedence{
Ref,
Insteadof,
}
}
// Attributes returns node attributes as map
func (n *TraitUsePrecedence) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *TraitUsePrecedence) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.Ref != nil {
v.EnterChildNode("Ref", n)
n.Ref.Walk(v)
v.LeaveChildNode("Ref", n)
}
if n.Insteadof != nil {
v.EnterChildList("Insteadof", n)
for _, nn := range n.Insteadof {
if nn != nil {
nn.Walk(v)
}
}
v.LeaveChildList("Insteadof", n)
}
v.LeaveNode(n)
}