use of com.google.devtools.j2objc.ast.DoStatement in project j2objc by google.
the class UnsequencedExpressionRewriter method visit.
@Override
public boolean visit(DoStatement node) {
node.getBody().accept(this);
newExpression(node.getExpression());
node.getExpression().accept(this);
List<VariableAccess> toExtract = getUnsequencedAccesses();
if (!toExtract.isEmpty()) {
// Convert "while (cond)" into "while (true) { if (!(cond)) break; ... }".
List<Statement> stmtList = TreeUtil.asStatementList(node.getBody());
extractOrderedAccesses(stmtList, currentTopNode, toExtract);
stmtList.add(createLoopTermination(node.getExpression()));
node.setExpression(new BooleanLiteral(true, typeUtil));
}
return false;
}
Aggregations