1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Bug 285901 - Format function does not work properly when define constant to type cast

This commit is contained in:
Anton Leherbauer 2010-01-15 11:37:35 +00:00
parent 3b8ad5a4cd
commit a75cc9c45a
2 changed files with 18 additions and 2 deletions

View file

@ -1886,10 +1886,17 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
scribe.space(); scribe.space();
} }
node.getTypeId().accept(this); node.getTypeId().accept(this);
try {
if (node.getTypeId().getTrailingSyntax().getType() == IToken.tRPAREN) {
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_cast); scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_cast);
if (preferences.insert_space_after_closing_paren_in_cast) { if (preferences.insert_space_after_closing_paren_in_cast) {
scribe.space(); scribe.space();
} }
}
} catch (UnsupportedOperationException exc) {
} catch (ExpansionOverlapsBoundaryException exc) {
scribe.space();
}
// operand // operand
node.getOperand().accept(this); node.getOperand().accept(this);
break; break;

View file

@ -1347,4 +1347,13 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testWideStringLiteral_Bug292626() throws Exception { public void testWideStringLiteral_Bug292626() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
//#define INT (int)
//int i = INT 1;
//#define INT (int)
//int i = INT 1;
public void testCastAsMacro_Bug285901() throws Exception {
assertFormatterResult();
}
} }