php-parser/node/stmt/catch.go
2018-01-05 00:12:01 +02:00

57 lines
862 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
type Catch struct {
position *node.Position
Types []node.Node
Variable node.Node
Stmts []node.Node
}
func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) node.Node {
return &Catch{
nil,
Types,
Variable,
Stmts,
}
}
func (n Catch) Attributes() map[string]interface{} {
return nil
}
func (n Catch) Position() *node.Position {
return n.position
}
func (n Catch) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n Catch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.Types != nil {
vv := v.GetChildrenVisitor("Types")
for _, nn := range n.Types {
nn.Walk(vv)
}
}
if n.Stmts != nil {
vv := v.GetChildrenVisitor("Stmts")
for _, nn := range n.Stmts {
nn.Walk(vv)
}
}
v.LeaveNode(n)
}