use of com.google.errorprone.refaster.ControlFlowVisitor.Result in project error-prone by google.
the class ControlFlowVisitor method visitSwitch.
@Override
public Result visitSwitch(SwitchTree node, BreakContext cxt) {
Result result = null;
boolean seenDefault = false;
cxt.loopDepth++;
try {
for (CaseTree caseTree : node.getCases()) {
if (caseTree.getExpression() == null) {
seenDefault = true;
}
if (result == null) {
result = caseTree.accept(this, cxt);
} else {
result = result.or(caseTree.accept(this, cxt));
}
}
if (!seenDefault) {
result = result.or(NEVER_EXITS);
}
return result;
} finally {
cxt.loopDepth--;
}
}
use of com.google.errorprone.refaster.ControlFlowVisitor.Result in project error-prone by google.
the class ControlFlowVisitor method visitIf.
@Override
public Result visitIf(IfTree node, BreakContext cxt) {
Result thenResult = node.getThenStatement().accept(this, cxt);
Result elseResult = (node.getElseStatement() == null) ? NEVER_EXITS : node.getElseStatement().accept(this, cxt);
return thenResult.or(elseResult);
}