forked from qt-creator/qt-creator
QmlJs: fix reformatting of 'signal' statements
Reformatting 'signal' preceded by comments used to bring to a bad formatted file. Task-number: QTCREATORBUG-17886 Change-Id: I02e093a4721cd1e75d45b498ea768251aee88ea4 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -150,8 +150,12 @@ protected:
|
|||||||
void outCommentText(const QString &str)
|
void outCommentText(const QString &str)
|
||||||
{
|
{
|
||||||
QStringList lines = str.split(QLatin1Char('\n'));
|
QStringList lines = str.split(QLatin1Char('\n'));
|
||||||
|
bool multiline = lines.length() > 1;
|
||||||
for (int i = 0; i < lines.size(); ++i) {
|
for (int i = 0; i < lines.size(); ++i) {
|
||||||
_line = lines.at(i); // multiline comments don't keep track of previos lines
|
if (multiline)
|
||||||
|
_line = lines.at(i); // multiline comments don't keep track of previos lines
|
||||||
|
else
|
||||||
|
_line += lines.at(i);
|
||||||
if (i != lines.size() - 1)
|
if (i != lines.size() - 1)
|
||||||
newLine();
|
newLine();
|
||||||
}
|
}
|
||||||
@@ -582,7 +586,7 @@ protected:
|
|||||||
out(ast->identifierToken);
|
out(ast->identifierToken);
|
||||||
}
|
}
|
||||||
} else { // signal
|
} else { // signal
|
||||||
out("signal ");
|
out("signal ", ast->identifierToken);
|
||||||
out(ast->identifierToken);
|
out(ast->identifierToken);
|
||||||
if (ast->parameters) {
|
if (ast->parameters) {
|
||||||
out("(");
|
out("(");
|
||||||
|
|||||||
@@ -13,4 +13,14 @@ Item {
|
|||||||
/*
|
/*
|
||||||
Indented multiline comment.
|
Indented multiline comment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Comment over a signal.
|
||||||
|
signal foo
|
||||||
|
|
||||||
|
function test() {
|
||||||
|
for (var i = model.count - 1; i >= 0; --i) // in-line comment
|
||||||
|
{
|
||||||
|
console.log("test")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user