php-parser/node/stmt/group_use.go
2018-01-02 14:11:08 +02:00

82 lines
1.4 KiB
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
type GroupUse struct {
name string
attributes map[string]interface{}
position *node.Position
useType node.Node
prefix node.Node
useList []node.Node
}
func NewGroupUse(useType node.Node, prefix node.Node, useList []node.Node) node.Node {
return GroupUse{
"GroupUse",
map[string]interface{}{},
nil,
useType,
prefix,
useList,
}
}
func (n GroupUse) Name() string {
return "GroupUse"
}
func (n GroupUse) Attributes() map[string]interface{} {
return n.attributes
}
func (n GroupUse) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n GroupUse) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n GroupUse) Position() *node.Position {
return n.position
}
func (n GroupUse) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n GroupUse) SetUseType(useType node.Node) node.Node {
n.useType = useType
return n
}
func (n GroupUse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.useType != nil {
vv := v.GetChildrenVisitor("useType")
n.useType.Walk(vv)
}
if n.prefix != nil {
vv := v.GetChildrenVisitor("prefix")
n.prefix.Walk(vv)
}
if n.useList != nil {
vv := v.GetChildrenVisitor("useList")
for _, nn := range n.useList {
nn.Walk(vv)
}
}
v.LeaveNode(n)
}