1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Formatter bug fixes.

This commit is contained in:
Sergey Prigogin 2011-03-31 06:33:36 +00:00
parent 3452064a2f
commit ae5c304eec
2 changed files with 24 additions and 8 deletions

View file

@ -3384,15 +3384,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
int nextToken= peekNextToken(); int nextToken= peekNextToken();
if (node.getPropertyInParent() != ICPPASTQualifiedName.SEGMENT_NAME || nextToken == Token.tGT) { if (node.getPropertyInParent() != ICPPASTQualifiedName.SEGMENT_NAME || nextToken == Token.tGT) {
if (node.getParent().getPropertyInParent() == IASTFunctionCallExpression.FUNCTION_NAME && if (nextToken == Token.tLPAREN) {
preferences.insert_space_before_opening_paren_in_method_invocation) { if (preferences.insert_space_before_opening_paren_in_method_invocation)
scribe.space(); scribe.space();
} else if (node.getParent().getPropertyInParent() != IASTFunctionCallExpression.FUNCTION_NAME && } else if (preferences.insert_space_after_closing_angle_bracket_in_template_arguments) {
preferences.insert_space_after_closing_angle_bracket_in_template_arguments) { // Avoid explicit space if followed by '*' or '&'.
// Avoid explicit space if followed by '*' or '&'. if (nextToken != Token.tSTAR && nextToken != Token.tAMPER)
if (nextToken != Token.tSTAR && nextToken != Token.tAMPER) {
scribe.space(); scribe.space();
}
} else { } else {
scribe.printComment(); scribe.printComment();
scribe.needSpace= false; scribe.needSpace= false;

View file

@ -1244,6 +1244,24 @@ public class CodeFormatterTest extends BaseUITestCase {
assertFormatterResult(); assertFormatterResult();
} }
//template<typename T>
//class A {
//};
//
//A<int> a = new A <int> ();
//A<int> b = A <int> ();
//template<typename T>
//class A {
//};
//
//A<int> a = new A<int>();
//A<int> b = A<int>();
public void testTemplateConstructorCall() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
assertFormatterResult();
}
//#define MY_MACRO int a; \ //#define MY_MACRO int a; \
// int b; \ // int b; \
// int c(); // int c();