39 lines
649 B
Go
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)
|
|
}
|
|
}
|