forked from qt-creator/qt-creator
qmljsreformatter: don't default foreach type to "in"
Fixes: QTCREATORBUG-29123 Change-Id: I4d3a611c359946c4483388cbf18a0b6f16d0a8d6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
@@ -1088,7 +1088,10 @@ protected:
|
|||||||
out(" ");
|
out(" ");
|
||||||
out(ast->lparenToken);
|
out(ast->lparenToken);
|
||||||
accept(ast->lhs);
|
accept(ast->lhs);
|
||||||
|
if (ast->type == ForEachType::In)
|
||||||
out(" in ");
|
out(" in ");
|
||||||
|
else
|
||||||
|
out(" of ");
|
||||||
accept(ast->expression);
|
accept(ast->expression);
|
||||||
out(ast->rparenToken);
|
out(ast->rparenToken);
|
||||||
acceptBlockOrIndented(ast->statement);
|
acceptBlockOrIndented(ast->statement);
|
||||||
|
|||||||
9
tests/auto/qml/reformatter/forEachType.qml
Normal file
9
tests/auto/qml/reformatter/forEachType.qml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import QtQml
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i of ["one", "two", "free"]) {
|
||||||
|
console.debug(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user