php-parser/node/expr/class_const_fetch.go

38 lines
712 B
Go
Raw Normal View History

2017-12-16 20:14:26 +00:00
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
2017-12-27 17:55:58 +00:00
func (n ClassConstFetch) Name() string {
return "ClassConstFetch"
}
2017-12-16 20:14:26 +00:00
type ClassConstFetch struct {
2017-12-27 17:55:58 +00:00
name string
class node.Node
constant token.Token
2017-12-16 20:14:26 +00:00
}
2017-12-27 17:55:58 +00:00
func NewClassConstFetch(class node.Node, constant token.Token) node.Node {
2017-12-16 20:14:26 +00:00
return ClassConstFetch{
2017-12-27 17:55:58 +00:00
"ClassConstFetch",
2017-12-16 20:14:26 +00:00
class,
2017-12-27 17:55:58 +00:00
constant,
2017-12-16 20:14:26 +00:00
}
}
func (n ClassConstFetch) Print(out io.Writer, indent string) {
2017-12-27 17:55:58 +00:00
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.constant.Value)
2017-12-16 20:14:26 +00:00
if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ")
n.class.Print(out, indent+" ")
}
}