1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Code streamlining.

This commit is contained in:
Sergey Prigogin 2011-01-31 18:51:49 +00:00
parent 253c5f1f03
commit bc8b98729f

View file

@ -3441,17 +3441,18 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
try { try {
statement.accept(this); statement.accept(this);
} catch (RuntimeException e) { } catch (RuntimeException e) {
if (i < statementsLength - 1) { if (i >= statementsLength - 1) {
reportFormattingProblem(e); throw e;
exitAlignments(); }
skipToNode(statements.get(i + 1)); reportFormattingProblem(e);
while (scribe.indentationLevel < indentLevel) { exitAlignments();
scribe.indent(); skipToNode(statements.get(i + 1));
} while (scribe.indentationLevel < indentLevel) {
while (scribe.indentationLevel > indentLevel) { scribe.indent();
scribe.unIndent(); }
} while (scribe.indentationLevel > indentLevel) {
} else throw e; scribe.unIndent();
}
} }
previousStatement= statement; previousStatement= statement;
} }
@ -3474,9 +3475,9 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
localScanner.resetTo(start, end); localScanner.resetTo(start, end);
if (localScanner.getNextToken() == Token.tLBRACE) { if (localScanner.getNextToken() == Token.tLBRACE) {
switch (localScanner.getNextToken()) { switch (localScanner.getNextToken()) {
case Token.tBLOCKCOMMENT : case Token.tBLOCKCOMMENT:
case Token.tLINECOMMENT : case Token.tLINECOMMENT:
return true; return true;
} }
} }
return false; return false;
@ -3504,8 +3505,8 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
int token = localScanner.getNextToken(); int token = localScanner.getNextToken();
loop: while (true) { loop: while (true) {
switch (token) { switch (token) {
case Token.tBLOCKCOMMENT : case Token.tBLOCKCOMMENT:
case Token.tLINECOMMENT : case Token.tLINECOMMENT:
token = localScanner.getNextToken(); token = localScanner.getNextToken();
continue loop; continue loop;
default: default: