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

37 lines
712 B
Go
Raw Normal View History

2017-12-12 21:26:00 +00:00
package assign_op
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
type AssignOp struct {
node.SimpleNode
variable node.Node
expression node.Node
}
func NewAssignOp(variable node.Node, expression node.Node) node.Node {
return AssignOp{
node.SimpleNode{Name: "AssignOp", Attributes: make(map[string]string)},
variable,
expression,
}
}
func (n AssignOp) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
if n.variable != nil {
fmt.Fprintf(out, "\n%vvariable:", indent+" ")
n.variable.Print(out, indent+" ")
}
if n.expression != nil {
fmt.Fprintf(out, "\n%vexpression:", indent+" ")
n.expression.Print(out, indent+" ")
}
}