(node *Node)
| 16 | type predicateCombination struct{} |
| 17 | |
| 18 | func (v *predicateCombination) Visit(node *Node) { |
| 19 | if op, ok := (*node).(*BinaryNode); ok && operator.IsBoolean(op.Operator) { |
| 20 | if left, ok := op.Left.(*BuiltinNode); ok { |
| 21 | if combinedOp, ok := combinedOperator(left.Name, op.Operator); ok { |
| 22 | if right, ok := op.Right.(*BuiltinNode); ok && right.Name == left.Name { |
| 23 | if left.Arguments[0].Type() == right.Arguments[0].Type() && left.Arguments[0].String() == right.Arguments[0].String() { |
| 24 | predicate := &PredicateNode{ |
| 25 | Node: &BinaryNode{ |
| 26 | Operator: combinedOp, |
| 27 | Left: left.Arguments[1].(*PredicateNode).Node, |
| 28 | Right: right.Arguments[1].(*PredicateNode).Node, |
| 29 | }, |
| 30 | } |
| 31 | v.Visit(&predicate.Node) |
| 32 | patchCopyType(node, &BuiltinNode{ |
| 33 | Name: left.Name, |
| 34 | Arguments: []Node{ |
| 35 | left.Arguments[0], |
| 36 | predicate, |
| 37 | }, |
| 38 | }) |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func combinedOperator(fn, op string) (string, bool) { |
| 47 | switch { |
nothing calls this directly
no test coverage detected