php-parser/node/expr/instance_of.go
2017-12-27 19:55:58 +02:00

41 lines
657 B
Go

package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
func (n InstanceOf) Name() string {
return "InstanceOf"
}
type InstanceOf struct {
name string
expr node.Node
class node.Node
}
func NewInstanceOf(expr node.Node, class node.Node) node.Node {
return InstanceOf{
"InstanceOf",
expr,
class,
}
}
func (n InstanceOf) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
if n.expr != nil {
fmt.Fprintf(out, "\n%vexpr:", indent+" ")
n.expr.Print(out, indent+" ")
}
if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ")
n.class.Print(out, indent+" ")
}
}