コード例 #1
0
 private static boolean whileStatementsAreEquivalent(
     @NotNull GrWhileStatement statement1, @NotNull GrWhileStatement statement2) {
   final GrExpression condition1 = (GrExpression) statement1.getCondition();
   final GrExpression condition2 = (GrExpression) statement2.getCondition();
   final GrStatement body1 = statement1.getBody();
   final GrStatement body2 = statement2.getBody();
   return expressionsAreEquivalent(condition1, condition2)
       && statementsAreEquivalent(body1, body2);
 }
コード例 #2
0
 public void visitWhileStatement(GrWhileStatement whileStatement) {
   final InstructionImpl instruction = startNode(whileStatement);
   final GrCondition condition = whileStatement.getCondition();
   if (condition != null) {
     condition.accept(this);
   }
   if (!alwaysTrue(condition)) {
     addPendingEdge(whileStatement, myHead); // break
   }
   final GrCondition body = whileStatement.getBody();
   if (body != null) {
     body.accept(this);
   }
   checkPending(instruction); // check for breaks targeted here
   if (myHead != null) addEdge(myHead, instruction); // loop
   interruptFlow();
   finishNode(instruction);
 }