66 lines
1.2 KiB
Go
66 lines
1.2 KiB
Go
package stmt
|
|
|
|
import (
|
|
"github.com/z7zmey/php-parser/node"
|
|
"github.com/z7zmey/php-parser/walker"
|
|
)
|
|
|
|
// GroupUse node
|
|
type GroupUse struct {
|
|
UseType node.Node
|
|
Prefix node.Node
|
|
UseList []node.Node
|
|
}
|
|
|
|
// NewGroupUse node constructor
|
|
func NewGroupUse(UseType node.Node, Prefix node.Node, UseList []node.Node) *GroupUse {
|
|
return &GroupUse{
|
|
UseType,
|
|
Prefix,
|
|
UseList,
|
|
}
|
|
}
|
|
|
|
// Attributes returns node attributes as map
|
|
func (n *GroupUse) Attributes() map[string]interface{} {
|
|
return nil
|
|
}
|
|
|
|
// SetUseType set use type and returns node
|
|
func (n *GroupUse) SetUseType(UseType node.Node) node.Node {
|
|
n.UseType = UseType
|
|
return n
|
|
}
|
|
|
|
// Walk traverses nodes
|
|
// Walk is invoked recursively until v.EnterNode returns true
|
|
func (n *GroupUse) Walk(v walker.Visitor) {
|
|
if v.EnterNode(n) == false {
|
|
return
|
|
}
|
|
|
|
if n.UseType != nil {
|
|
v.EnterChildNode("UseType", n)
|
|
n.UseType.Walk(v)
|
|
v.LeaveChildNode("UseType", n)
|
|
}
|
|
|
|
if n.Prefix != nil {
|
|
v.EnterChildNode("Prefix", n)
|
|
n.Prefix.Walk(v)
|
|
v.LeaveChildNode("Prefix", n)
|
|
}
|
|
|
|
if n.UseList != nil {
|
|
v.EnterChildList("UseList", n)
|
|
for _, nn := range n.UseList {
|
|
if nn != nil {
|
|
nn.Walk(v)
|
|
}
|
|
}
|
|
v.LeaveChildList("UseList", n)
|
|
}
|
|
|
|
v.LeaveNode(n)
|
|
}
|