php-parser/node/stmt/declare.go
2017-12-28 13:36:27 +02:00

47 lines
695 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func (n Declare) Name() string {
return "Declare"
}
type Declare struct {
name string
token token.Token
consts []node.Node
stmt node.Node
}
func NewDeclare(token token.Token, consts []node.Node, stmt node.Node) node.Node {
return Declare{
"Declare",
token,
consts,
stmt,
}
}
func (n Declare) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.consts != nil {
vv := v.GetChildrenVisitor("consts")
for _, nn := range n.consts {
nn.Walk(vv)
}
}
if n.stmt != nil {
vv := v.GetChildrenVisitor("stmt")
n.stmt.Walk(vv)
}
v.LeaveNode(n)
}