56 lines
933 B
Go
56 lines
933 B
Go
package stmt
|
|
|
|
import (
|
|
"github.com/z7zmey/php-parser/node"
|
|
)
|
|
|
|
type StaticVar struct {
|
|
name string
|
|
attributes map[string]interface{}
|
|
variable node.Node
|
|
expr node.Node
|
|
}
|
|
|
|
func NewStaticVar(variable node.Node, expr node.Node) node.Node {
|
|
return StaticVar{
|
|
"StaticVar",
|
|
map[string]interface{}{},
|
|
variable,
|
|
expr,
|
|
}
|
|
}
|
|
|
|
func (n StaticVar) Name() string {
|
|
return "StaticVar"
|
|
}
|
|
|
|
func (n StaticVar) Attributes() map[string]interface{} {
|
|
return n.attributes
|
|
}
|
|
|
|
func (n StaticVar) Attribute(key string) interface{} {
|
|
return n.attributes[key]
|
|
}
|
|
|
|
func (n StaticVar) SetAttribute(key string, value interface{}) {
|
|
n.attributes[key] = value
|
|
}
|
|
|
|
func (n StaticVar) Walk(v node.Visitor) {
|
|
if v.EnterNode(n) == false {
|
|
return
|
|
}
|
|
|
|
if n.variable != nil {
|
|
vv := v.GetChildrenVisitor("variable")
|
|
n.variable.Walk(vv)
|
|
}
|
|
|
|
if n.expr != nil {
|
|
vv := v.GetChildrenVisitor("expr")
|
|
n.expr.Walk(vv)
|
|
}
|
|
|
|
v.LeaveNode(n)
|
|
}
|