@Override
public Void visitIfStatement(IfStatement node) {
Expression condition = node.getCondition();
safelyVisit(condition);
Map<Element, Type> thenOverrides = null;
Statement thenStatement = node.getThenStatement();
if (thenStatement != null) {
overrideManager.enterScope();
try {
promoteManager.enterScope();
try {
propagateTrueState(condition);
// Type promotion.
promoteTypes(condition);
clearTypePromotionsIfPotentiallyMutatedIn(thenStatement);
clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(thenStatement);
// Visit "then".
visitStatementInScope(thenStatement);
} finally {
promoteManager.exitScope();
}
} finally {
thenOverrides = overrideManager.captureLocalOverrides();
overrideManager.exitScope();
}
}
Map<Element, Type> elseOverrides = null;
Statement elseStatement = node.getElseStatement();
if (elseStatement != null) {
overrideManager.enterScope();
try {
propagateFalseState(condition);
visitStatementInScope(elseStatement);