#31 dump to native golang struct
This commit is contained in:
		
							parent
							
								
									063726aac4
								
							
						
					
					
						commit
						dd572a8fed
					
				
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							| @ -99,7 +99,7 @@ func printer(result <-chan parser.Parser) { | ||||
| 			nsResolver := visitor.NewNamespaceResolver() | ||||
| 			parserWorker.GetRootNode().Walk(nsResolver) | ||||
| 
 | ||||
| 			dumper := visitor.Dumper{ | ||||
| 			dumper := &visitor.Dumper{ | ||||
| 				Writer:     os.Stdout, | ||||
| 				Indent:     "  | ", | ||||
| 				Comments:   parserWorker.GetComments(), | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Assign) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Reference) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseAnd) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseOr) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseXor) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Concat) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Div) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Minus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Mod) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Mul) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Plus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Pow) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ShiftLeft) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ShiftRight) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expression != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expression") | ||||
| 		n.Expression.Walk(vv) | ||||
| 		v.EnterChildNode("Expression", n) | ||||
| 		n.Expression.Walk(v) | ||||
| 		v.LeaveChildNode("Expression", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -20,112 +20,112 @@ var nodesToTest = []struct { | ||||
| }{ | ||||
| 	{ | ||||
| 		&assign.Reference{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Assign{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.BitwiseAnd{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.BitwiseOr{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.BitwiseXor{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Concat{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Div{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Minus{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Mod{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Mul{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Plus{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.Pow{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.ShiftLeft{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&assign.ShiftRight{ | ||||
| 			Variable:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Variable:   &expr.Variable{}, | ||||
| 			Expression: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Expression"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -138,11 +138,15 @@ type visitorMock struct { | ||||
| } | ||||
| 
 | ||||
| func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren } | ||||
| func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| 	return &visitorMock{v.visitChildren, nil} | ||||
| } | ||||
| func (v *visitorMock) LeaveNode(n walker.Walkable)      {} | ||||
| func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {} | ||||
| func (v *visitorMock) EnterChildList(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {} | ||||
| 
 | ||||
| func TestVisitorDisableChildren(t *testing.T) { | ||||
| 	for _, tt := range nodesToTest { | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseAnd) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseOr) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BitwiseXor) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BooleanAnd) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *BooleanOr) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Coalesce) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Concat) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Div) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Equal) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Greater) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *GreaterOrEqual) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Identical) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *LogicalAnd) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *LogicalOr) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *LogicalXor) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Minus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Mod) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Mul) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *NotEqual) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *NotIdentical) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Plus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Pow) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ShiftLeft) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ShiftRight) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Smaller) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *SmallerOrEqual) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Spaceship) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Left != nil { | ||||
| 		vv := v.GetChildrenVisitor("Left") | ||||
| 		n.Left.Walk(vv) | ||||
| 		v.EnterChildNode("Left", n) | ||||
| 		n.Left.Walk(v) | ||||
| 		v.LeaveChildNode("Left", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Right != nil { | ||||
| 		vv := v.GetChildrenVisitor("Right") | ||||
| 		n.Right.Walk(vv) | ||||
| 		v.EnterChildNode("Right", n) | ||||
| 		n.Right.Walk(v) | ||||
| 		v.LeaveChildNode("Right", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -19,216 +19,216 @@ var nodesToTest = []struct { | ||||
| }{ | ||||
| 	{ | ||||
| 		&binary.BitwiseAnd{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.BitwiseOr{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.BitwiseXor{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.BooleanAnd{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.BooleanOr{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Coalesce{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Concat{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Div{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Equal{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.GreaterOrEqual{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Greater{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Identical{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.LogicalAnd{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.LogicalOr{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.LogicalXor{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Minus{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Mod{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Mul{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.NotEqual{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.NotIdentical{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Plus{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Pow{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.ShiftLeft{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.ShiftRight{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.SmallerOrEqual{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Smaller{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&binary.Spaceship{ | ||||
| 			Left:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Left:  &expr.Variable{}, | ||||
| 			Right: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Left", "Right"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -241,11 +241,15 @@ type visitorMock struct { | ||||
| } | ||||
| 
 | ||||
| func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren } | ||||
| func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| 	return &visitorMock{v.visitChildren, nil} | ||||
| } | ||||
| func (v *visitorMock) LeaveNode(n walker.Walkable)      {} | ||||
| func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {} | ||||
| func (v *visitorMock) EnterChildList(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {} | ||||
| 
 | ||||
| func TestVisitorDisableChildren(t *testing.T) { | ||||
| 	for _, tt := range nodesToTest { | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Array) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Bool) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Double) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Int) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Object) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *String) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Unset) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -19,49 +19,49 @@ var nodesToTest = []struct { | ||||
| }{ | ||||
| 	{ | ||||
| 		&cast.Array{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.Bool{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.Double{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.Int{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.Object{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.String{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&cast.Unset{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -74,11 +74,15 @@ type visitorMock struct { | ||||
| } | ||||
| 
 | ||||
| func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren } | ||||
| func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| 	return &visitorMock{v.visitChildren, nil} | ||||
| } | ||||
| func (v *visitorMock) LeaveNode(n walker.Walkable)      {} | ||||
| func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {} | ||||
| func (v *visitorMock) EnterChildList(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {} | ||||
| 
 | ||||
| func TestVisitorDisableChildren(t *testing.T) { | ||||
| 	for _, tt := range nodesToTest { | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *Array) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Items != nil { | ||||
| 		vv := v.GetChildrenVisitor("Items") | ||||
| 		v.EnterChildList("Items", n) | ||||
| 		for _, nn := range n.Items { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Items", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ArrayDimFetch) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Dim != nil { | ||||
| 		vv := v.GetChildrenVisitor("Dim") | ||||
| 		n.Dim.Walk(vv) | ||||
| 		v.EnterChildNode("Dim", n) | ||||
| 		n.Dim.Walk(v) | ||||
| 		v.LeaveChildNode("Dim", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ArrayItem) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Key != nil { | ||||
| 		vv := v.GetChildrenVisitor("Key") | ||||
| 		n.Key.Walk(vv) | ||||
| 		v.EnterChildNode("Key", n) | ||||
| 		n.Key.Walk(v) | ||||
| 		v.LeaveChildNode("Key", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Val != nil { | ||||
| 		vv := v.GetChildrenVisitor("Val") | ||||
| 		n.Val.Walk(vv) | ||||
| 		v.EnterChildNode("Val", n) | ||||
| 		n.Val.Walk(v) | ||||
| 		v.LeaveChildNode("Val", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *BitwiseNot) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *BooleanNot) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *ClassConstFetch) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Class != nil { | ||||
| 		vv := v.GetChildrenVisitor("Class") | ||||
| 		n.Class.Walk(vv) | ||||
| 		v.EnterChildNode("Class", n) | ||||
| 		n.Class.Walk(v) | ||||
| 		v.LeaveChildNode("Class", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ConstantName != nil { | ||||
| 		vv := v.GetChildrenVisitor("ConstantName") | ||||
| 		n.ConstantName.Walk(vv) | ||||
| 		v.EnterChildNode("ConstantName", n) | ||||
| 		n.ConstantName.Walk(v) | ||||
| 		v.LeaveChildNode("ConstantName", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Clone) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -46,31 +46,35 @@ func (n *Closure) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Params != nil { | ||||
| 		vv := v.GetChildrenVisitor("Params") | ||||
| 		v.EnterChildList("Params", n) | ||||
| 		for _, nn := range n.Params { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Params", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ClosureUse != nil { | ||||
| 		vv := v.GetChildrenVisitor("ClosureUse") | ||||
| 		n.ClosureUse.Walk(vv) | ||||
| 		v.EnterChildNode("ClosureUse", n) | ||||
| 		n.ClosureUse.Walk(v) | ||||
| 		v.LeaveChildNode("ClosureUse", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ReturnType != nil { | ||||
| 		vv := v.GetChildrenVisitor("ReturnType") | ||||
| 		n.ReturnType.Walk(vv) | ||||
| 		v.EnterChildNode("ReturnType", n) | ||||
| 		n.ReturnType.Walk(v) | ||||
| 		v.LeaveChildNode("ReturnType", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Stmts != nil { | ||||
| 		vv := v.GetChildrenVisitor("Stmts") | ||||
| 		v.EnterChildList("Stmts", n) | ||||
| 		for _, nn := range n.Stmts { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Stmts", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *ClosureUse) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Uses != nil { | ||||
| 		vv := v.GetChildrenVisitor("Uses") | ||||
| 		v.EnterChildList("Uses", n) | ||||
| 		for _, nn := range n.Uses { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Uses", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *ConstFetch) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Constant != nil { | ||||
| 		vv := v.GetChildrenVisitor("Constant") | ||||
| 		n.Constant.Walk(vv) | ||||
| 		v.EnterChildNode("Constant", n) | ||||
| 		n.Constant.Walk(v) | ||||
| 		v.LeaveChildNode("Constant", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Die) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Empty) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *ErrorSuppress) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Eval) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Exit) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *FunctionCall) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Function != nil { | ||||
| 		vv := v.GetChildrenVisitor("Function") | ||||
| 		n.Function.Walk(vv) | ||||
| 		v.EnterChildNode("Function", n) | ||||
| 		n.Function.Walk(v) | ||||
| 		v.LeaveChildNode("Function", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ArgumentList != nil { | ||||
| 		vv := v.GetChildrenVisitor("ArgumentList") | ||||
| 		n.ArgumentList.Walk(vv) | ||||
| 		v.EnterChildNode("ArgumentList", n) | ||||
| 		n.ArgumentList.Walk(v) | ||||
| 		v.LeaveChildNode("ArgumentList", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Include) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *IncludeOnce) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *InstanceOf) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Class != nil { | ||||
| 		vv := v.GetChildrenVisitor("Class") | ||||
| 		n.Class.Walk(vv) | ||||
| 		v.EnterChildNode("Class", n) | ||||
| 		n.Class.Walk(v) | ||||
| 		v.LeaveChildNode("Class", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *Isset) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variables != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variables") | ||||
| 		v.EnterChildList("Variables", n) | ||||
| 		for _, nn := range n.Variables { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Variables", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *List) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Items != nil { | ||||
| 		vv := v.GetChildrenVisitor("Items") | ||||
| 		v.EnterChildList("Items", n) | ||||
| 		for _, nn := range n.Items { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Items", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -34,18 +34,21 @@ func (n *MethodCall) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Method != nil { | ||||
| 		vv := v.GetChildrenVisitor("Method") | ||||
| 		n.Method.Walk(vv) | ||||
| 		v.EnterChildNode("Method", n) | ||||
| 		n.Method.Walk(v) | ||||
| 		v.LeaveChildNode("Method", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ArgumentList != nil { | ||||
| 		vv := v.GetChildrenVisitor("ArgumentList") | ||||
| 		n.ArgumentList.Walk(vv) | ||||
| 		v.EnterChildNode("ArgumentList", n) | ||||
| 		n.ArgumentList.Walk(v) | ||||
| 		v.LeaveChildNode("ArgumentList", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *New) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Class != nil { | ||||
| 		vv := v.GetChildrenVisitor("Class") | ||||
| 		n.Class.Walk(vv) | ||||
| 		v.EnterChildNode("Class", n) | ||||
| 		n.Class.Walk(v) | ||||
| 		v.LeaveChildNode("Class", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ArgumentList != nil { | ||||
| 		vv := v.GetChildrenVisitor("ArgumentList") | ||||
| 		n.ArgumentList.Walk(vv) | ||||
| 		v.EnterChildNode("ArgumentList", n) | ||||
| 		n.ArgumentList.Walk(v) | ||||
| 		v.LeaveChildNode("ArgumentList", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *PostDec) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *PostInc) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *PreDec) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *PreInc) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Print) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *PropertyFetch) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Property != nil { | ||||
| 		vv := v.GetChildrenVisitor("Property") | ||||
| 		n.Property.Walk(vv) | ||||
| 		v.EnterChildNode("Property", n) | ||||
| 		n.Property.Walk(v) | ||||
| 		v.LeaveChildNode("Property", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Reference) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *Require) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *RequireOnce) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *ShellExec) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Parts != nil { | ||||
| 		vv := v.GetChildrenVisitor("Parts") | ||||
| 		v.EnterChildList("Parts", n) | ||||
| 		for _, nn := range n.Parts { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Parts", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *ShortArray) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Items != nil { | ||||
| 		vv := v.GetChildrenVisitor("Items") | ||||
| 		v.EnterChildList("Items", n) | ||||
| 		for _, nn := range n.Items { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Items", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,12 +30,13 @@ func (n *ShortList) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Items != nil { | ||||
| 		vv := v.GetChildrenVisitor("Items") | ||||
| 		v.EnterChildList("Items", n) | ||||
| 		for _, nn := range n.Items { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Items", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -34,18 +34,21 @@ func (n *StaticCall) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Class != nil { | ||||
| 		vv := v.GetChildrenVisitor("Class") | ||||
| 		n.Class.Walk(vv) | ||||
| 		v.EnterChildNode("Class", n) | ||||
| 		n.Class.Walk(v) | ||||
| 		v.LeaveChildNode("Class", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Call != nil { | ||||
| 		vv := v.GetChildrenVisitor("Call") | ||||
| 		n.Call.Walk(vv) | ||||
| 		v.EnterChildNode("Call", n) | ||||
| 		n.Call.Walk(v) | ||||
| 		v.LeaveChildNode("Call", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.ArgumentList != nil { | ||||
| 		vv := v.GetChildrenVisitor("ArgumentList") | ||||
| 		n.ArgumentList.Walk(vv) | ||||
| 		v.EnterChildNode("ArgumentList", n) | ||||
| 		n.ArgumentList.Walk(v) | ||||
| 		v.LeaveChildNode("ArgumentList", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *StaticPropertyFetch) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Class != nil { | ||||
| 		vv := v.GetChildrenVisitor("Class") | ||||
| 		n.Class.Walk(vv) | ||||
| 		v.EnterChildNode("Class", n) | ||||
| 		n.Class.Walk(v) | ||||
| 		v.LeaveChildNode("Class", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Property != nil { | ||||
| 		vv := v.GetChildrenVisitor("Property") | ||||
| 		n.Property.Walk(vv) | ||||
| 		v.EnterChildNode("Property", n) | ||||
| 		n.Property.Walk(v) | ||||
| 		v.LeaveChildNode("Property", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -34,18 +34,21 @@ func (n *Ternary) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Condition != nil { | ||||
| 		vv := v.GetChildrenVisitor("Condition") | ||||
| 		n.Condition.Walk(vv) | ||||
| 		v.EnterChildNode("Condition", n) | ||||
| 		n.Condition.Walk(v) | ||||
| 		v.LeaveChildNode("Condition", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.IfTrue != nil { | ||||
| 		vv := v.GetChildrenVisitor("IfTrue") | ||||
| 		n.IfTrue.Walk(vv) | ||||
| 		v.EnterChildNode("IfTrue", n) | ||||
| 		n.IfTrue.Walk(v) | ||||
| 		v.LeaveChildNode("IfTrue", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.IfFalse != nil { | ||||
| 		vv := v.GetChildrenVisitor("IfFalse") | ||||
| 		n.IfFalse.Walk(vv) | ||||
| 		v.EnterChildNode("IfFalse", n) | ||||
| 		n.IfFalse.Walk(v) | ||||
| 		v.LeaveChildNode("IfFalse", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *UnaryMinus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *UnaryPlus) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -35,8 +35,9 @@ func (n *Variable) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.VarName != nil { | ||||
| 		vv := v.GetChildrenVisitor("VarName") | ||||
| 		n.VarName.Walk(vv) | ||||
| 		v.EnterChildNode("VarName", n) | ||||
| 		n.VarName.Walk(v) | ||||
| 		v.LeaveChildNode("VarName", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -32,13 +32,15 @@ func (n *Yield) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Key != nil { | ||||
| 		vv := v.GetChildrenVisitor("Key") | ||||
| 		n.Key.Walk(vv) | ||||
| 		v.EnterChildNode("Key", n) | ||||
| 		n.Key.Walk(v) | ||||
| 		v.LeaveChildNode("Key", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Value != nil { | ||||
| 		vv := v.GetChildrenVisitor("Value") | ||||
| 		n.Value.Walk(vv) | ||||
| 		v.EnterChildNode("Value", n) | ||||
| 		n.Value.Walk(v) | ||||
| 		v.LeaveChildNode("Value", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -30,8 +30,9 @@ func (n *YieldFrom) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -24,7 +24,7 @@ var nodesToTest = []struct { | ||||
| }{ | ||||
| 	{ | ||||
| 		&expr.ArrayDimFetch{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 			Dim:      &scalar.Lnumber{Value: "1"}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Dim"}, | ||||
| @ -41,10 +41,7 @@ var nodesToTest = []struct { | ||||
| 	{ | ||||
| 		&expr.Array{ | ||||
| 			Items: []node.Node{ | ||||
| 				&expr.ArrayItem{ | ||||
| 					Key: &scalar.String{Value: "key"}, | ||||
| 					Val: &scalar.Lnumber{Value: "1"}, | ||||
| 				}, | ||||
| 				&expr.ArrayItem{}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		[]string{"Items"}, | ||||
| @ -52,21 +49,21 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.BitwiseNot{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.BooleanNot{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.ClassConstFetch{ | ||||
| 			Class:        &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Class:        &expr.Variable{}, | ||||
| 			ConstantName: &node.Identifier{Value: "foo"}, | ||||
| 		}, | ||||
| 		[]string{"Class", "ConstantName"}, | ||||
| @ -74,7 +71,7 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Clone{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -82,7 +79,7 @@ var nodesToTest = []struct { | ||||
| 	{ | ||||
| 		&expr.ClosureUse{ | ||||
| 			Uses: []node.Node{ | ||||
| 				&expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 				&expr.Variable{}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		[]string{"Uses"}, | ||||
| @ -110,42 +107,42 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Empty{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.ErrorSuppress{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Eval{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Exit{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Die{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.FunctionCall{ | ||||
| 			Function:     &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Function:     &expr.Variable{}, | ||||
| 			ArgumentList: &node.ArgumentList{}, | ||||
| 		}, | ||||
| 		[]string{"Function", "ArgumentList"}, | ||||
| @ -153,21 +150,21 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.IncludeOnce{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Include{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.InstanceOf{ | ||||
| 			Expr:  &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr:  &expr.Variable{}, | ||||
| 			Class: &name.Name{}, | ||||
| 		}, | ||||
| 		[]string{"Expr", "Class"}, | ||||
| @ -176,7 +173,7 @@ var nodesToTest = []struct { | ||||
| 	{ | ||||
| 		&expr.Isset{ | ||||
| 			Variables: []node.Node{ | ||||
| 				&expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 				&expr.Variable{}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		[]string{"Variables"}, | ||||
| @ -193,7 +190,7 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.MethodCall{ | ||||
| 			Variable:     &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable:     &expr.Variable{}, | ||||
| 			Method:       &node.Identifier{Value: "foo"}, | ||||
| 			ArgumentList: &node.ArgumentList{}, | ||||
| 		}, | ||||
| @ -210,42 +207,42 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.PostDec{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.PostInc{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.PreDec{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.PreInc{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Print{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.PropertyFetch{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 			Property: &node.Identifier{Value: "foo"}, | ||||
| 		}, | ||||
| 		[]string{"Variable", "Property"}, | ||||
| @ -253,21 +250,21 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Reference{ | ||||
| 			Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Variable: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Variable"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.RequireOnce{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Require{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -318,23 +315,23 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Ternary{ | ||||
| 			Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			IfTrue:    &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			IfFalse:   &expr.Variable{VarName: &node.Identifier{Value: "c"}}, | ||||
| 			Condition: &expr.Variable{}, | ||||
| 			IfTrue:    &expr.Variable{}, | ||||
| 			IfFalse:   &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Condition", "IfTrue", "IfFalse"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.UnaryMinus{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.UnaryPlus{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -346,15 +343,15 @@ var nodesToTest = []struct { | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.YieldFrom{ | ||||
| 			Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Expr: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Expr"}, | ||||
| 		map[string]interface{}{}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		&expr.Yield{ | ||||
| 			Key:   &expr.Variable{VarName: &node.Identifier{Value: "a"}}, | ||||
| 			Value: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, | ||||
| 			Key:   &expr.Variable{}, | ||||
| 			Value: &expr.Variable{}, | ||||
| 		}, | ||||
| 		[]string{"Key", "Value"}, | ||||
| 		map[string]interface{}{}, | ||||
| @ -367,11 +364,15 @@ type visitorMock struct { | ||||
| } | ||||
| 
 | ||||
| func (v *visitorMock) EnterNode(n walker.Walkable) bool { return v.visitChildren } | ||||
| func (v *visitorMock) GetChildrenVisitor(key string) walker.Visitor { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| 	return &visitorMock{v.visitChildren, nil} | ||||
| } | ||||
| func (v *visitorMock) LeaveNode(n walker.Walkable)      {} | ||||
| func (v *visitorMock) EnterChildNode(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildNode(key string, w walker.Walkable) {} | ||||
| func (v *visitorMock) EnterChildList(key string, w walker.Walkable) { | ||||
| 	v.visitedKeys = append(v.visitedKeys, key) | ||||
| } | ||||
| func (v *visitorMock) LeaveChildList(key string, w walker.Walkable) {} | ||||
| 
 | ||||
| func TestVisitorDisableChildren(t *testing.T) { | ||||
| 	for _, tt := range nodesToTest { | ||||
|  | ||||
| @ -34,8 +34,9 @@ func (n *Argument) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -29,12 +29,13 @@ func (n *ArgumentList) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Arguments != nil { | ||||
| 		vv := v.GetChildrenVisitor("Arguments") | ||||
| 		v.EnterChildList("Arguments", n) | ||||
| 		for _, nn := range n.Arguments { | ||||
| 			if nn != nil { | ||||
| 				nn.Walk(vv) | ||||
| 				nn.Walk(v) | ||||
| 			} | ||||
| 		} | ||||
| 		v.LeaveChildList("Arguments", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -27,8 +27,9 @@ func (n *Nullable) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Expr != nil { | ||||
| 		vv := v.GetChildrenVisitor("Expr") | ||||
| 		n.Expr.Walk(vv) | ||||
| 		v.EnterChildNode("Expr", n) | ||||
| 		n.Expr.Walk(v) | ||||
| 		v.LeaveChildNode("Expr", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
| @ -38,18 +38,21 @@ func (n *Parameter) Walk(v walker.Visitor) { | ||||
| 	} | ||||
| 
 | ||||
| 	if n.VariableType != nil { | ||||
| 		vv := v.GetChildrenVisitor("VariableType") | ||||
| 		n.VariableType.Walk(vv) | ||||
| 		v.EnterChildNode("VariableType", n) | ||||
| 		n.VariableType.Walk(v) | ||||
| 		v.LeaveChildNode("VariableType", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.Variable != nil { | ||||
| 		vv := v.GetChildrenVisitor("Variable") | ||||
| 		n.Variable.Walk(vv) | ||||
| 		v.EnterChildNode("Variable", n) | ||||
| 		n.Variable.Walk(v) | ||||
| 		v.LeaveChildNode("Variable", n) | ||||
| 	} | ||||
| 
 | ||||
| 	if n.DefaultValue != nil { | ||||
| 		vv := v.GetChildrenVisitor("DefaultValue") | ||||
| 		n.DefaultValue.Walk(vv) | ||||
| 		v.EnterChildNode("DefaultValue", n) | ||||
| 		n.DefaultValue.Walk(v) | ||||
| 		v.LeaveChildNode("DefaultValue", n) | ||||
| 	} | ||||
| 
 | ||||
| 	v.LeaveNode(n) | ||||
|  | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user