php-parser/node/expr/cast/cast.go

30 lines
479 B
Go
Raw Normal View History

2017-12-12 21:26:00 +00:00
package cast
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Cast struct {
node.SimpleNode
expr node.Node
}
func NewCast(expr node.Node) node.Node {
return Cast{
node.SimpleNode{Name: "Cast", Attributes: make(map[string]string)},
expr,
}
}
func (n Cast) 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+" ")
}
}