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

36 lines
500 B
Go

package stmt
import (
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func (n Goto) Name() string {
return "Goto"
}
type Goto struct {
name string
token token.Token
label token.Token
}
// todl label must be identifier
func NewGoto(token token.Token, label token.Token) node.Node {
return Goto{
"Goto",
token,
label,
}
}
func (n Goto) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return
}
v.Scalar("label", n.label.Value)
v.LeaveNode(n)
}