C++ indenter: Fix for use of << and >> in parentheses.

Task-number: QTCREATORBUG-4076
This commit is contained in:
Christian Kamm
2011-03-15 15:05:05 +01:00
parent 4fa528813e
commit faff0c8ace
2 changed files with 20 additions and 1 deletions

View File

@@ -225,8 +225,9 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
else // stream_op_cont already else // stream_op_cont already
turnInto(stream_op_cont); turnInto(stream_op_cont);
break; break;
case T_RPAREN:
case T_COMMA: case T_COMMA:
case T_SEMICOLON: leave(); continue; // always nested, propagate semicolon case T_SEMICOLON: leave(); continue; // always nested, propagate
} break; } break;
case member_init_open: case member_init_open:

View File

@@ -71,6 +71,7 @@ private Q_SLOTS:
void braceList(); void braceList();
void bug1(); void bug1();
void bug2(); void bug2();
void bug3();
void switch1(); void switch1();
void memberInitializer(); void memberInitializer();
void templates(); void templates();
@@ -669,6 +670,23 @@ void tst_CodeFormatter::bug2()
checkIndent(data); checkIndent(data);
} }
void tst_CodeFormatter::bug3()
{
QList<Line> data;
data << Line("class AutoAttack")
<< Line("{")
<< Line("public:")
<< Line(" AutoAttack(unsigned delay, unsigned warmup)")
<< Line(" ~ : mWarmup(warmup && warmup < delay ? warmup : delay >> 2)")
<< Line(" {}")
<< Line(" unsigned getWarmup() const { return mWarmup; }")
<< Line("private:")
<< Line(" unsigned mWarmup;")
<< Line("}")
;
checkIndent(data);
}
void tst_CodeFormatter::braceList() void tst_CodeFormatter::braceList()
{ {
QList<Line> data; QList<Line> data;