assign_ref node
This commit is contained in:
@@ -1,30 +1,19 @@
|
||||
package assign_op
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type Assign struct {
|
||||
AssignOp
|
||||
byRef bool
|
||||
}
|
||||
|
||||
func NewAssign(variable node.Node, expression node.Node, byRef bool) node.Node {
|
||||
func NewAssign(variable node.Node, expression node.Node) node.Node {
|
||||
return Assign{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignAssign", Attributes: make(map[string]string)},
|
||||
node.SimpleNode{Name: "Assign", Attributes: make(map[string]string)},
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
byRef,
|
||||
}
|
||||
}
|
||||
|
||||
func (n Assign) Print(out io.Writer, indent string) {
|
||||
n.AssignOp.Print(out, indent)
|
||||
|
||||
fmt.Fprintf(out, "\n%vbyRef: %t", indent+" ", n.byRef)
|
||||
}
|
||||
|
||||
@@ -13,14 +13,6 @@ type AssignOp struct {
|
||||
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)
|
||||
|
||||
@@ -28,7 +20,7 @@ func (n AssignOp) Print(out io.Writer, indent string) {
|
||||
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+" ")
|
||||
|
||||
19
node/expr/assign_op/assign_ref.go
Normal file
19
node/expr/assign_op/assign_ref.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package assign_op
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type AssignRef struct {
|
||||
AssignOp
|
||||
}
|
||||
|
||||
func NewAssignRef(variable node.Node, expression node.Node) node.Node {
|
||||
return AssignRef{
|
||||
AssignOp{
|
||||
node.SimpleNode{Name: "AssignRef", Attributes: make(map[string]string)},
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user