php-parser/node/stmt/else_if.go
2017-12-29 17:53:13 +02:00

48 lines
710 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
type ElseIf struct {
name string
attributes map[string]interface{}
cond node.Node
stmt node.Node
}
func NewElseIf(cond node.Node, stmt node.Node) node.Node {
return ElseIf{
"ElseIf",
map[string]interface{}{},
cond,
stmt,
}
}
func (n ElseIf) Name() string {
return "ElseIf"
}
func (n ElseIf) Attributes() map[string]interface{} {
return n.attributes
}
func (n ElseIf) 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)
}