clone node

This commit is contained in:
z7zmey
2017-12-16 22:17:31 +02:00
parent cf084b5893
commit df662aaa01
3 changed files with 31 additions and 2 deletions

29
node/expr/clone.go Normal file
View File

@@ -0,0 +1,29 @@
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+" ")
}
}