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

68 lines
1.2 KiB
Go

package expr
import (
"github.com/z7zmey/php-parser/node"
)
type ClassConstFetch struct {
name string
attributes map[string]interface{}
position *node.Position
class node.Node
constantName node.Node
}
func NewClassConstFetch(class node.Node, constantName node.Node) node.Node {
return ClassConstFetch{
"ClassConstFetch",
map[string]interface{}{},
nil,
class,
constantName,
}
}
func (n ClassConstFetch) Name() string {
return "ClassConstFetch"
}
func (n ClassConstFetch) Attributes() map[string]interface{} {
return n.attributes
}
func (n ClassConstFetch) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n ClassConstFetch) SetAttribute(key string, value interface{}) node.Node {
n.attributes[key] = value
return n
}
func (n ClassConstFetch) Position() *node.Position {
return n.position
}
func (n ClassConstFetch) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n ClassConstFetch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.constantName != nil {
vv := v.GetChildrenVisitor("constantName")
n.constantName.Walk(vv)
}
if n.class != nil {
vv := v.GetChildrenVisitor("class")
n.class.Walk(vv)
}
v.LeaveNode(n)
}