php-parser/node/expr/variable.go
2018-01-04 23:26:04 +02:00

46 lines
719 B
Go

package expr
import (
"github.com/z7zmey/php-parser/node"
)
type Variable struct {
attributes map[string]interface{}
position *node.Position
VarName node.Node
}
func NewVariable(VarName node.Node) node.Node {
return &Variable{
map[string]interface{}{},
nil,
VarName,
}
}
func (n Variable) Attributes() map[string]interface{} {
return n.attributes
}
func (n Variable) Position() *node.Position {
return n.position
}
func (n Variable) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n Variable) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.VarName != nil {
vv := v.GetChildrenVisitor("VarName")
n.VarName.Walk(vv)
}
v.LeaveNode(n)
}