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

Function isNegationOf

pkg/workflow/expression_optimizer.go:115–123  ·  view source on GitHub ↗

isNegationOf returns true when b is the logical negation of a or a is the logical negation of b (handles both A / !A and !A / A cases).

(a, b ConditionNode)

Source from the content-addressed store, hash-verified

113// isNegationOf returns true when b is the logical negation of a or a is the
114// logical negation of b (handles both A / !A and !A / A cases).
115func isNegationOf(a, b ConditionNode) bool {
116 if notB, ok := b.(*NotNode); ok && nodesEqual(a, notB.Child) {
117 return true
118 }
119 if notA, ok := a.(*NotNode); ok && nodesEqual(notA.Child, b) {
120 return true
121 }
122 return false
123}
124
125// containsStatusFunc returns true when any node in the tree is a status function.
126// Used to gate complement / idempotent rules that must not fire on expressions

Callers 4

optimizeAndNodeFunction · 0.85
optimizeOrNodeFunction · 0.85
optimizeDisjunctionNodeFunction · 0.85
TestIsNegationOfFunction · 0.85

Calls 1

nodesEqualFunction · 0.85

Tested by 1

TestIsNegationOfFunction · 0.68