collectAndTerms recursively flattens a chain of AndNode into a flat slice of leaf terms so that cross-chain deduplication can be performed in a single pass.
(node ConditionNode)
| 165 | // collectAndTerms recursively flattens a chain of AndNode into a flat slice of |
| 166 | // leaf terms so that cross-chain deduplication can be performed in a single pass. |
| 167 | func collectAndTerms(node ConditionNode) []ConditionNode { |
| 168 | if and, ok := node.(*AndNode); ok { |
| 169 | return append(collectAndTerms(and.Left), collectAndTerms(and.Right)...) |
| 170 | } |
| 171 | return []ConditionNode{node} |
| 172 | } |
| 173 | |
| 174 | // rebuildAndChain assembles a left-folded AndNode chain from a non-empty slice. |
| 175 | func rebuildAndChain(terms []ConditionNode) ConditionNode { |
no outgoing calls