1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-04-26 03:21:37 +00:00
parent e6291e80c0
commit ae98f347c0

View file

@ -42,7 +42,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
/** /**
* This visitor looks for "switch" statements and invokes "SwitchVisitor" on * This visitor looks for "switch" statements and invokes "SwitchVisitor" on
* them * them.
*/ */
class SwitchFindingVisitor extends ASTVisitor { class SwitchFindingVisitor extends ASTVisitor {
SwitchFindingVisitor() { SwitchFindingVisitor() {
@ -91,10 +91,10 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
// next is case or end of switch - means this one is the last // next is case or end of switch - means this one is the last
if (prevCase != null && (isCaseStatement(next) || next == null)) { if (prevCase != null && (isCaseStatement(next) || next == null)) {
// check that current statement end with break or any other exit statement // check that current statement end with break or any other exit statement
if (_checkEmptyCase == false && isCaseStatement(curr) && next != null) { if (!_checkEmptyCase && isCaseStatement(curr) && next != null) {
continue; // empty case & we don't care continue; // empty case & we don't care
} }
if (_checkLastCase == false && next == null) { if (!_checkLastCase && next == null) {
continue; // last case and we don't care continue; // last case and we don't care
} }
if (isFallThroughStamement(curr)) { if (isFallThroughStamement(curr)) {
@ -103,7 +103,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
comment = getLeadingComment(next); comment = getLeadingComment(next);
} else { } else {
comment = getFreestandingComment(statement); comment = getFreestandingComment(statement);
if (comment==null) if (comment == null)
comment = getFreestandingComment(body); comment = getFreestandingComment(body);
} }
if (comment != null) { if (comment != null) {
@ -134,7 +134,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
* @return * @return
*/ */
public boolean isFallThroughStamement(IASTStatement body) { public boolean isFallThroughStamement(IASTStatement body) {
if (body==null) return true; if (body == null) return true;
if (body instanceof IASTCompoundStatement) { if (body instanceof IASTCompoundStatement) {
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements(); IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
return isFallThroughStamement(statements[statements.length - 1]); return isFallThroughStamement(statements[statements.length - 1]);