php-parser/node/stmt/declare.go
2017-12-28 01:23:32 +02:00

45 lines
654 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.Visit(n) == false {
return
}
if n.consts != nil {
vv := v.Children("consts")
for _, nn := range n.consts {
nn.Walk(vv)
}
}
if n.stmt != nil {
vv := v.Children("stmt")
n.stmt.Walk(vv)
}
}