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
+2 -1
View File
@@ -225,8 +225,9 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
else // stream_op_cont already
turnInto(stream_op_cont);
break;
case T_RPAREN:
case T_COMMA:
case T_SEMICOLON: leave(); continue; // always nested, propagate semicolon
case T_SEMICOLON: leave(); continue; // always nested, propagate
} break;
case member_init_open:
@@ -71,6 +71,7 @@ private Q_SLOTS:
void braceList();
void bug1();
void bug2();
void bug3();
void switch1();
void memberInitializer();
void templates();
@@ -669,6 +670,23 @@ void tst_CodeFormatter::bug2()
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()
{
QList<Line> data;