diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2009-01-07 10:59:36 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2009-01-07 10:59:36 +0100 |
commit | f4bf0a3a6db41dd7ce6f122053a0d144c01b5bd8 (patch) | |
tree | e17ad3b3833726d05d2a784e96d65d19c2364c2f /shared/cplusplus/PrettyPrinter.cpp | |
parent | 8ec03e6bcd7d7ed7ee1e22c96bcfb46b86cdc3bf (diff) | |
download | qt-creator-f4bf0a3a6db41dd7ce6f122053a0d144c01b5bd8.tar.gz |
Checkpoint. Pretty printing of switch and case statements.
Diffstat (limited to 'shared/cplusplus/PrettyPrinter.cpp')
-rw-r--r-- | shared/cplusplus/PrettyPrinter.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/shared/cplusplus/PrettyPrinter.cpp b/shared/cplusplus/PrettyPrinter.cpp index 620cb0bd2a..2acb98b14e 100644 --- a/shared/cplusplus/PrettyPrinter.cpp +++ b/shared/cplusplus/PrettyPrinter.cpp @@ -198,7 +198,24 @@ bool PrettyPrinter::visit(CaseStatementAST *ast) out << "case "; accept(ast->expression); out << ':'; - accept(ast->statement); + if (! ast->statement) { + newline(); + return false; + } + + if (ast->statement->asCompoundStatement()) { + out << ' '; + accept(ast->statement); + } else if (ast->statement->asCaseStatement() || ast->statement->asLabeledStatement()) { + newline(); + accept(ast->statement); + } else { + indent(); + newline(); + accept(ast->statement); + deindent(); + newline(); + } return false; } |