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

41 lines
590 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func (n Trait) Name() string {
return "Trait"
}
type Trait struct {
name string
token token.Token
stmts []node.Node
}
//TODO: stmts myst be []node.Node
func NewTrait(token token.Token, stmts []node.Node) node.Node {
return Trait{
"Trait",
token,
stmts,
}
}
func (n Trait) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
if n.stmts != nil {
vv := v.Children("stmts")
for _, nn := range n.stmts {
nn.Walk(vv)
}
}
}