php-parser/node/expr/class_const_fetch.go
2017-12-28 01:23:32 +02:00

39 lines
649 B
Go

package expr
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func (n ClassConstFetch) Name() string {
return "ClassConstFetch"
}
type ClassConstFetch struct {
name string
class node.Node
constant token.Token
}
// TODO: constant must be identifier
func NewClassConstFetch(class node.Node, constant token.Token) node.Node {
return ClassConstFetch{
"ClassConstFetch",
class,
constant,
}
}
func (n ClassConstFetch) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("constant", n.constant.Value)
if n.class != nil {
vv := v.Children("class")
n.class.Walk(vv)
}
}