MCPcopy Create free account
hub / github.com/github/gh-aw / collectAndTerms

Function collectAndTerms

pkg/workflow/expression_optimizer.go:167–172  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
167func 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.
175func rebuildAndChain(terms []ConditionNode) ConditionNode {

Callers 4

termSubsumedByFunction · 0.85
optimizeAndNodeFunction · 0.85
TestCollectAndTerms_FlatFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestCollectAndTerms_FlatFunction · 0.68