php-parser/node/expr/clone.go

30 lines
496 B
Go
Raw Normal View History

2017-12-16 20:17:31 +00:00
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type Clone struct {
node.SimpleNode
expr node.Node
}
func NewClone(expression node.Node) node.Node {
return Clone{
node.SimpleNode{Name: "Clone", Attributes: make(map[string]string)},
expression,
}
}
func (n Clone) 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+" ")
}
}