remove SimpleNode
This commit is contained in:
@@ -8,27 +8,19 @@ import (
|
||||
)
|
||||
|
||||
type BinaryOp struct {
|
||||
node.SimpleNode
|
||||
left node.Node
|
||||
name string
|
||||
left node.Node
|
||||
right node.Node
|
||||
}
|
||||
|
||||
func NewBinaryOp(left node.Node, right node.Node) node.Node {
|
||||
return BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryOp", Attributes: make(map[string]string)},
|
||||
left,
|
||||
right,
|
||||
}
|
||||
}
|
||||
|
||||
func (n BinaryOp) Print(out io.Writer, indent string) {
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.Name)
|
||||
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
|
||||
|
||||
if n.left != nil {
|
||||
fmt.Fprintf(out, "\n%vleft:", indent+" ")
|
||||
n.left.Print(out, indent+" ")
|
||||
}
|
||||
|
||||
|
||||
if n.right != nil {
|
||||
fmt.Fprintf(out, "\n%vright:", indent+" ")
|
||||
n.right.Print(out, indent+" ")
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BitwiseAnd) Name() string {
|
||||
return "BitwiseAnd"
|
||||
}
|
||||
|
||||
type BitwiseAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type BitwiseAnd struct {
|
||||
func NewBitwiseAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseAnd", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -8,12 +8,16 @@ type BitwiseOr struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
|
||||
func NewBitwiseOr(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseOr", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseOr) Name() string {
|
||||
return "BitwiseOr"
|
||||
}
|
||||
|
||||
@@ -8,12 +8,16 @@ type BitwiseXor struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
|
||||
func NewBitwiseXor(variable node.Node, expression node.Node) node.Node {
|
||||
return BitwiseXor{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBitwiseXor", Attributes: make(map[string]string)},
|
||||
"BinaryBitwiseXor",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (n BitwiseXor) Name() string {
|
||||
return "BitwiseXor"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BooleanAnd) Name() string {
|
||||
return "BooleanAnd"
|
||||
}
|
||||
|
||||
type BooleanAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type BooleanAnd struct {
|
||||
func NewBooleanAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return BooleanAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBooleanAnd", Attributes: make(map[string]string)},
|
||||
"BinaryBooleanAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n BooleanOr) Name() string {
|
||||
return "BooleanOr"
|
||||
}
|
||||
|
||||
type BooleanOr struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type BooleanOr struct {
|
||||
func NewBooleanOr(variable node.Node, expression node.Node) node.Node {
|
||||
return BooleanOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryBooleanOr", Attributes: make(map[string]string)},
|
||||
"BinaryBooleanOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Coalesce) Name() string {
|
||||
return "Coalesce"
|
||||
}
|
||||
|
||||
type Coalesce struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Coalesce struct {
|
||||
func NewCoalesce(variable node.Node, expression node.Node) node.Node {
|
||||
return Coalesce{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryCoalesce", Attributes: make(map[string]string)},
|
||||
"BinaryCoalesce",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Concat) Name() string {
|
||||
return "Concat"
|
||||
}
|
||||
|
||||
type Concat struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewConcat(variable node.Node, expression node.Node) node.Node {
|
||||
func NewConcat(variable node.Node, expression node.Node) node.Node {
|
||||
return Concat{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryConcat", Attributes: make(map[string]string)},
|
||||
"BinaryConcat",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Div) Name() string {
|
||||
return "Div"
|
||||
}
|
||||
|
||||
type Div struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewDiv(variable node.Node, expression node.Node) node.Node {
|
||||
func NewDiv(variable node.Node, expression node.Node) node.Node {
|
||||
return Div{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryDiv", Attributes: make(map[string]string)},
|
||||
"BinaryDiv",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Equal) Name() string {
|
||||
return "Equal"
|
||||
}
|
||||
|
||||
type Equal struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Equal struct {
|
||||
func NewEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return Equal{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryEqual", Attributes: make(map[string]string)},
|
||||
"BinaryEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Greater) Name() string {
|
||||
return "Greater"
|
||||
}
|
||||
|
||||
type Greater struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Greater struct {
|
||||
func NewGreater(variable node.Node, expression node.Node) node.Node {
|
||||
return Greater{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryGreater", Attributes: make(map[string]string)},
|
||||
"BinaryGreater",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n GreaterOrEqual) Name() string {
|
||||
return "GreaterOrEqual"
|
||||
}
|
||||
|
||||
type GreaterOrEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type GreaterOrEqual struct {
|
||||
func NewGreaterOrEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return GreaterOrEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryGreaterOrEqual", Attributes: make(map[string]string)},
|
||||
"BinaryGreaterOrEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Identical) Name() string {
|
||||
return "Identical"
|
||||
}
|
||||
|
||||
type Identical struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Identical struct {
|
||||
func NewIdentical(variable node.Node, expression node.Node) node.Node {
|
||||
return Identical{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryIdentical", Attributes: make(map[string]string)},
|
||||
"BinaryIdentical",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalAnd) Name() string {
|
||||
return "LogicalAnd"
|
||||
}
|
||||
|
||||
type LogicalAnd struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type LogicalAnd struct {
|
||||
func NewLogicalAnd(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalAnd{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalAnd", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalAnd",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalOr) Name() string {
|
||||
return "LogicalOr"
|
||||
}
|
||||
|
||||
type LogicalOr struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type LogicalOr struct {
|
||||
func NewLogicalOr(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalOr{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalOr", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalOr",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n LogicalXor) Name() string {
|
||||
return "LogicalXor"
|
||||
}
|
||||
|
||||
type LogicalXor struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type LogicalXor struct {
|
||||
func NewLogicalXor(variable node.Node, expression node.Node) node.Node {
|
||||
return LogicalXor{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryLogicalXor", Attributes: make(map[string]string)},
|
||||
"BinaryLogicalXor",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func (n Minus) Name() string {
|
||||
return "Minus"
|
||||
}
|
||||
|
||||
type Minus struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewMinus(variable node.Node, expression node.Node) node.Node {
|
||||
func NewMinus(variable node.Node, expression node.Node) node.Node {
|
||||
return Minus{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMinus", Attributes: make(map[string]string)},
|
||||
"BinaryMinus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Mod) Name() string {
|
||||
return "Mod"
|
||||
}
|
||||
|
||||
type Mod struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewMod(variable node.Node, expression node.Node) node.Node {
|
||||
func NewMod(variable node.Node, expression node.Node) node.Node {
|
||||
return Mod{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMod", Attributes: make(map[string]string)},
|
||||
"BinaryMod",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Mul) Name() string {
|
||||
return "Mul"
|
||||
}
|
||||
|
||||
type Mul struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewMul(variable node.Node, expression node.Node) node.Node {
|
||||
func NewMul(variable node.Node, expression node.Node) node.Node {
|
||||
return Mul{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryMul", Attributes: make(map[string]string)},
|
||||
"BinaryMul",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n NotEqual) Name() string {
|
||||
return "NotEqual"
|
||||
}
|
||||
|
||||
type NotEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type NotEqual struct {
|
||||
func NewNotEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return NotEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryNotEqual", Attributes: make(map[string]string)},
|
||||
"BinaryNotEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n NotIdentical) Name() string {
|
||||
return "NotIdentical"
|
||||
}
|
||||
|
||||
type NotIdentical struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type NotIdentical struct {
|
||||
func NewNotIdentical(variable node.Node, expression node.Node) node.Node {
|
||||
return NotIdentical{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryNotIdentical", Attributes: make(map[string]string)},
|
||||
"BinaryNotIdentical",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Plus) Name() string {
|
||||
return "Plus"
|
||||
}
|
||||
|
||||
type Plus struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewPlus(variable node.Node, expression node.Node) node.Node {
|
||||
func NewPlus(variable node.Node, expression node.Node) node.Node {
|
||||
return Plus{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryPlus", Attributes: make(map[string]string)},
|
||||
"BinaryPlus",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Pow) Name() string {
|
||||
return "Pow"
|
||||
}
|
||||
|
||||
type Pow struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewPow(variable node.Node, expression node.Node) node.Node {
|
||||
func NewPow(variable node.Node, expression node.Node) node.Node {
|
||||
return Pow{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryPow", Attributes: make(map[string]string)},
|
||||
"BinaryPow",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n ShiftLeft) Name() string {
|
||||
return "ShiftLeft"
|
||||
}
|
||||
|
||||
type ShiftLeft struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
|
||||
func NewShiftLeft(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftLeft{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryShiftLeft", Attributes: make(map[string]string)},
|
||||
"BinaryShiftLeft",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,14 +4,18 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n ShiftRight) Name() string {
|
||||
return "ShiftRight"
|
||||
}
|
||||
|
||||
type ShiftRight struct {
|
||||
BinaryOp
|
||||
}
|
||||
|
||||
func NewShiftRight(variable node.Node, expression node.Node) node.Node {
|
||||
func NewShiftRight(variable node.Node, expression node.Node) node.Node {
|
||||
return ShiftRight{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinaryShiftRight", Attributes: make(map[string]string)},
|
||||
"BinaryShiftRight",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Smaller) Name() string {
|
||||
return "Smaller"
|
||||
}
|
||||
|
||||
type Smaller struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Smaller struct {
|
||||
func NewSmaller(variable node.Node, expression node.Node) node.Node {
|
||||
return Smaller{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySmaller", Attributes: make(map[string]string)},
|
||||
"BinarySmaller",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n SmallerOrEqual) Name() string {
|
||||
return "SmallerOrEqual"
|
||||
}
|
||||
|
||||
type SmallerOrEqual struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type SmallerOrEqual struct {
|
||||
func NewSmallerOrEqual(variable node.Node, expression node.Node) node.Node {
|
||||
return SmallerOrEqual{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySmallerOrEqual", Attributes: make(map[string]string)},
|
||||
"BinarySmallerOrEqual",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,10 @@ import (
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
func(n Spaceship) Name() string {
|
||||
return "Spaceship"
|
||||
}
|
||||
|
||||
type Spaceship struct {
|
||||
BinaryOp
|
||||
}
|
||||
@@ -11,7 +15,7 @@ type Spaceship struct {
|
||||
func NewSpaceship(variable node.Node, expression node.Node) node.Node {
|
||||
return Spaceship{
|
||||
BinaryOp{
|
||||
node.SimpleNode{Name: "BinarySpaceship", Attributes: make(map[string]string)},
|
||||
"BinarySpaceship",
|
||||
variable,
|
||||
expression,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user