private Expression getConditionChild(TreeNode conditional) {
   if (conditional instanceof InfixExpression) {
     return ((InfixExpression) conditional).getOperands().get(0);
   } else if (conditional instanceof ConditionalExpression) {
     return ((ConditionalExpression) conditional).getExpression();
   } else {
     throw new AssertionError(
         "Unexpected conditional node type: " + conditional.getClass().toString());
   }
 }
 private void extractOrderedAccesses(
     List<Statement> stmtList, TreeNode subExpr, List<VariableAccess> toExtract) {
   for (int i = 0; i < toExtract.size(); i++) {
     VariableAccess access = toExtract.get(i);
     TreeNode topConditional = getTopConditional(access.expression, subExpr);
     if (topConditional != null) {
       // Conditional expressions require special handling when extracting the
       // access because execution of the access may not be guaranteed.
       // Here we collect all accesses that are decendant of the conditional
       // expression and pass them to an appropriate extraction method.
       int j = i + 1;
       for (; j < toExtract.size(); j++) {
         if (getTopConditional(toExtract.get(j).expression, subExpr) != topConditional) {
           break;
         }
       }
       if (topConditional instanceof InfixExpression) {
         extractInfixConditional(
             stmtList, (InfixExpression) topConditional, toExtract.subList(i, j));
       } else if (topConditional instanceof ConditionalExpression) {
         extractConditionalExpression(
             stmtList, (ConditionalExpression) topConditional, toExtract.subList(i, j));
       } else {
         throw new AssertionError(
             "Unexpected conditional node type: " + topConditional.getClass().toString());
       }
       i = j - 1;
     } else {
       IVariableBinding newVar =
           new GeneratedVariableBinding(
               "unseq$" + count++,
               0,
               access.expression.getTypeBinding(),
               false,
               false,
               null,
               currentMethod);
       stmtList.add(new VariableDeclarationStatement(newVar, access.expression.copy()));
       access.expression.replaceWith(new SimpleName(newVar));
     }
   }
 }