diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2009-01-07 10:33:19 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2009-01-07 10:33:19 +0100 |
commit | 0030f87e9c8e2a2cf529ffebac94ebb2fc72bf44 (patch) | |
tree | 035d0d88dfc5c3fa9195d2cce3fe278fedda3cda /shared/cplusplus/PrettyPrinter.cpp | |
parent | fb0d60ae66c0ae5b97536e2f4ce258e304553fee (diff) | |
download | qt-creator-0030f87e9c8e2a2cf529ffebac94ebb2fc72bf44.tar.gz |
Improved the pretty printing of enum specifiers and if-else statements.
Diffstat (limited to 'shared/cplusplus/PrettyPrinter.cpp')
-rw-r--r-- | shared/cplusplus/PrettyPrinter.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/shared/cplusplus/PrettyPrinter.cpp b/shared/cplusplus/PrettyPrinter.cpp index 8a8b43bb37..4adc69e78c 100644 --- a/shared/cplusplus/PrettyPrinter.cpp +++ b/shared/cplusplus/PrettyPrinter.cpp @@ -453,11 +453,20 @@ bool PrettyPrinter::visit(EnumSpecifierAST *ast) out << ' '; accept(ast->name); } + out << ' '; out << '{'; - for (EnumeratorAST *it = ast->enumerators; it; it = it->next) { - accept(it); - if (it->next) - out << ", "; + if (ast->enumerators) { + indent(); + newline(); + for (EnumeratorAST *it = ast->enumerators; it; it = it->next) { + accept(it); + if (it->next) { + out << ", "; + newline(); + } + } + deindent(); + newline(); } out << '}'; return false; @@ -599,9 +608,10 @@ bool PrettyPrinter::visit(IfStatementAST *ast) out << '('; accept(ast->condition); out << ')'; - if (ast->statement->asCompoundStatement()) + if (ast->statement->asCompoundStatement()) { + out << ' '; accept(ast->statement); - else { + } else { indent(); newline(); accept(ast->statement); |