php-parser/node/expr/closure_use.go

37 lines
522 B
Go
Raw Normal View History

2017-12-16 21:02:18 +00:00
package expr
import (
"github.com/z7zmey/php-parser/node"
)
2017-12-27 17:55:58 +00:00
func (n ClusureUse) Name() string {
return "ClusureUse"
}
2017-12-16 21:02:18 +00:00
type ClusureUse struct {
2017-12-27 17:55:58 +00:00
name string
2017-12-16 21:02:18 +00:00
variable node.Node
byRef bool
}
func NewClusureUse(variable node.Node, byRef bool) node.Node {
return ClusureUse{
2017-12-27 17:55:58 +00:00
"ClusureUse",
2017-12-16 21:02:18 +00:00
variable,
byRef,
}
}
2017-12-27 23:23:32 +00:00
func (n ClusureUse) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("byRef", n.byRef)
2017-12-16 21:02:18 +00:00
if n.variable != nil {
2017-12-27 23:23:32 +00:00
vv := v.Children("variable")
n.variable.Walk(vv)
2017-12-16 21:02:18 +00:00
}
}