Node tryFoldWhile ( Node n ) { checkArgument ( n . isWhile ( ) ) ; Node cond = NodeUtil . getConditionExpression ( n ) ; if ( NodeUtil . getPureBooleanValue ( cond ) != TernaryValue . FALSE ) { return n ; } NodeUtil . redeclareVarsInsideBranch ( n ) ; reportChangeToEnclosingScope ( n . getParent ( ) ) ; NodeUtil . removeChild ( n . getParent ( ) , n ) ; return null ; }
Removes WHILEs that always evaluate to false .