aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp4
-rw-r--r--tools/qmlformat/dumpastvisitor.cpp8
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index c3e5f40481..f1fb0d025f 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -143,10 +143,6 @@ void TestQmlformat::initTestCase()
m_invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml";
m_invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml";
m_invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml";
-
- // QTBUG-85321
- m_invalidFiles << "tests/manual/scenegraph_lancelot/data/shaders/propertyanimation/"
- "uniformanimator_stall.qml";
}
QStringList TestQmlformat::findFiles(const QDir &d)
diff --git a/tools/qmlformat/dumpastvisitor.cpp b/tools/qmlformat/dumpastvisitor.cpp
index 57a1ea9fcb..2b7b1c7c2f 100644
--- a/tools/qmlformat/dumpastvisitor.cpp
+++ b/tools/qmlformat/dumpastvisitor.cpp
@@ -603,7 +603,8 @@ bool needsSemicolon(int kind)
QString DumpAstVisitor::parseBlock(Block *block, bool hasNext, bool allowBraceless)
{
- bool hasOneLine = (block->statements == nullptr || block->statements->next == nullptr) && allowBraceless;
+ bool hasOneLine =
+ (block->statements != nullptr && block->statements->next == nullptr) && allowBraceless;
QString result = hasOneLine ? "\n" : "{\n";
m_indentLevel++;
@@ -619,6 +620,8 @@ QString DumpAstVisitor::parseBlock(Block *block, bool hasNext, bool allowBracele
if (block->statements) {
m_blockNeededBraces |= !needsSemicolon(block->statements->statement->kind)
|| (block->statements->next != nullptr);
+ } else {
+ m_blockNeededBraces = true;
}
return result;
@@ -864,6 +867,9 @@ QString DumpAstVisitor::parseStatementList(StatementList *list)
{
QString result = "";
+ if (list == nullptr)
+ return "";
+
result += getOrphanedComments(list);
for (auto *item = list; item != nullptr; item = item->next) {