php-parser/node/stmt/alt_else_if.go
2018-01-04 20:42:44 +02:00

62 lines
1.0 KiB
Go

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