diff options
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/qtbug34792.qml | 14 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 12 |
3 files changed, 29 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 62f65c0c9c..6b1169d30a 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -323,9 +323,9 @@ class DominatorTree { link(p, n); foreach (BasicBlock *v, bucket[p]) { BasicBlock *y = ancestorWithLowestSemi(v); - Q_ASSERT(semi[y] == p); - if (semi[y] == semi[v]) - idom[v] = p; + BasicBlock *semi_v = semi[v]; + if (semi[y] == semi_v) + idom[v] = semi_v; else samedom[v] = y; } diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml new file mode 100644 index 0000000000..37c551b587 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml @@ -0,0 +1,14 @@ +import QtQuick 2.1 +Rectangle { + function foo() + { + for (var i = 0; i < 1; i++) + { + if (i >= 0) + break + + return + } + + } +} diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 6e1e606fb8..3aa8fd42e0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -318,6 +318,7 @@ private slots: void miscTypeTest(); void stackLimits(); void idsAsLValues(); + void qtbug_34792(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -7477,6 +7478,17 @@ void tst_qqmlecmascript::idsAsLValues() QCOMPARE(component.errorString(), err); } +void tst_qqmlecmascript::qtbug_34792() +{ + QQmlComponent component(&engine, testFileUrl("qtbug34792.qml")); + + QObject *object = component.create(); + if (object == 0) + qDebug() << component.errorString(); + QVERIFY(object != 0); + delete object; +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |