php-parser/node/stmt/stmt_list.go
2017-12-31 13:15:50 +02:00

62 lines
1007 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
)
type StmtList struct {
name string
attributes map[string]interface{}
position *node.Position
stmts []node.Node
}
func NewStmtList(stmts []node.Node) node.Node {
return StmtList{
"StmtList",
map[string]interface{}{},
nil,
stmts,
}
}
func (n StmtList) Name() string {
return "StmtList"
}
func (n StmtList) Attributes() map[string]interface{} {
return n.attributes
}
func (n StmtList) Attribute(key string) interface{} {
return n.attributes[key]
}
func (n StmtList) SetAttribute(key string, value interface{}) {
n.attributes[key] = value
}
func (n StmtList) Position() *node.Position {
return n.position
}
func (n StmtList) SetPosition(p *node.Position) node.Node {
n.position = p
return n
}
func (n StmtList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
if n.stmts != nil {
vv := v.GetChildrenVisitor("stmts")
for _, nn := range n.stmts {
nn.Walk(vv)
}
}
v.LeaveNode(n)
}