private Node tryMinimizeHook ( Node n ) { Node originalCond = n . getFirstChild ( ) ; MinimizedCondition minCond = MinimizedCondition . fromConditionNode ( originalCond ) ; MeasuredNode mNode = minCond . getMinimized ( MinimizationStyle . ALLOW_LEADING_NOT ) ; if ( mNode . isNot ( ) ) { // Swap the HOOK Node thenBranch = n . getSecondChild ( ) ; replaceNode ( originalCond , mNode . withoutNot ( ) ) ; n . removeChild ( thenBranch ) ; n . addChildToBack ( thenBranch ) ; reportChangeToEnclosingScope ( n ) ; } else { replaceNode ( originalCond , mNode ) ; } return n ; }
Try flipping HOOKs that have negated conditions .