This commit is contained in:
z7zmey
2017-12-28 01:23:32 +02:00
parent 32a285b437
commit 79d3bb1674
159 changed files with 1659 additions and 1015 deletions

View File

@@ -21,3 +21,19 @@ func NewAssign(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Assign) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -1,9 +1,6 @@
package assign_op
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
)
@@ -12,17 +9,3 @@ type AssignOp struct {
variable node.Node
expression node.Node
}
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+" ")
}
}

View File

@@ -21,3 +21,19 @@ func NewAssignRef(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n AssignRef) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n BitwiseAnd) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n BitwiseOr) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
func (n BitwiseXor) Name() string {
return "BitwiseXor"
}
func (n BitwiseXor) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewConcat(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Concat) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewDiv(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Div) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewMinus(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Minus) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewMod(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Mod) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewMul(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Mul) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewPlus(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Plus) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewPow(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n Pow) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n ShiftLeft) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}

View File

@@ -21,3 +21,19 @@ func NewShiftRight(variable node.Node, expression node.Node) node.Node {
},
}
}
func (n ShiftRight) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.variable != nil {
vv := v.Children("variable")
n.variable.Walk(vv)
}
if n.expression != nil {
vv := v.Children("expression")
n.expression.Walk(vv)
}
}