php-parser/node/stmt/do.go
2018-01-11 19:34:42 +02:00

45 lines
687 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
// Do node
type Do struct {
Stmt node.Node
Cond node.Node
}
// NewDo node constuctor
func NewDo(Stmt node.Node, Cond node.Node) *Do {
return &Do{
Stmt,
Cond,
}
}
// Attributes returns node attributes as map
func (n *Do) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Do) 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)
}