This commit is contained in:
z7zmey
2017-12-18 18:51:16 +02:00
parent 4fc5d37b48
commit 85f7765e79
3 changed files with 42 additions and 4 deletions

38
node/expr/new.go Normal file
View File

@@ -0,0 +1,38 @@
package expr
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type New struct {
node.SimpleNode
class node.Node
arguments []node.Node
}
func NewNew(class node.Node, arguments []node.Node) node.Node {
return New{
node.SimpleNode{Name: "New", Attributes: make(map[string]string)},
class,
arguments,
}
}
func (n New) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
if n.class != nil {
fmt.Fprintf(out, "\n%vclass:", indent+" ")
n.class.Print(out, indent+" ")
}
if n.arguments != nil {
fmt.Fprintf(out, "\n%varguments:", indent+" ")
for _, nn := range n.arguments {
nn.Print(out, indent+" ")
}
}
}