if (branchStatement && statement != null) {
// reportSyntaxError("Unreachable code", statement.sourceStart,
// statement.sourceEnd);
- problemReporter.unreachableCode(new String(scanner.getCurrentIdentifierSource()), statement.sourceStart,
+ if (! (statement instanceof BreakStatement)) {
+ /* don't give an error for break statement following return statement
+ Technically it's unreachable code, but in switch-case it's recommended to
+ avoid accidental fall-through later when editing the code */
+ problemReporter.unreachableCode(new String(scanner.getCurrentIdentifierSource()), statement.sourceStart,
statement.sourceEnd, referenceContext, compilationUnit.compilationResult);
+ }
}
if ((token == TokenNameRBRACE) || (token == TokenNamecase) || (token == TokenNamedefault) || (token == TokenNameelse)
|| (token == TokenNameelseif) || (token == TokenNameendif) || (token == TokenNameendfor)