Commit 6d544bc2 authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar
Browse files

C++: handle braced return statements in indenter.



Task-number: QTCREATORBUG-9314

Change-Id: I59c026cce02b85eeb54f4d10d5c9fb0c59bfe28a
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent db4a8caf
......@@ -207,6 +207,8 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
// oops, the expression was a function declaration argument list, hand lbrace/colon to declaration_start
leave();
continue;
} else {
turnInto(substatement_open);
}
break;
default: tryExpression(); break;
......
......@@ -126,6 +126,7 @@ private Q_SLOTS:
void blockBraces1();
void functionDefaultArgument();
void attributeInAccessSpecifier();
void braceReturn();
};
struct Line {
......@@ -2097,6 +2098,19 @@ void tst_CodeFormatter::attributeInAccessSpecifier()
checkIndent(data);
}
void tst_CodeFormatter::braceReturn()
{
QList<Line> data;
data << Line("class X {")
<< Line(" void the_answer() {")
<< Line(" return {42};")
<< Line(" }")
<< Line(" int x;")
<< Line("};")
;
checkIndent(data);
}
QTEST_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment