diff options
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/jittedAsCast.qml | 15 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 13 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 01a7878dae..f27754f4a3 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -2440,6 +2440,7 @@ QHash<const void *, const char *> Runtime::symbolTable() {symbol<UMinus>(), "UMinus" }, {symbol<Instanceof>(), "Instanceof" }, + {symbol<As>(), "As" }, {symbol<In>(), "In" }, {symbol<Add>(), "Add" }, {symbol<Sub>(), "Sub" }, diff --git a/tests/auto/qml/qqmllanguage/data/jittedAsCast.qml b/tests/auto/qml/qqmllanguage/data/jittedAsCast.qml new file mode 100644 index 0000000000..e1798a5d35 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/jittedAsCast.qml @@ -0,0 +1,15 @@ +import QtQml + +QtObject { + property QtObject obj: Timer { + interval: 1 + running: true + repeat: true + onTriggered: { + if (++interval === 10) + running = false + } + } + property bool running: (obj as Timer).running + property int interval: (obj as Timer).interval +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 6226f4ec1a..052d9173a2 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -369,6 +369,8 @@ private slots: void variantListConversion(); void thisInArrowFunction(); + void jittedAsCast(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -6420,6 +6422,17 @@ void tst_qqmllanguage::thisInArrowFunction() QCOMPARE(qvariant_cast<QObject *>(o->property("ffResult")), child); } +void tst_qqmllanguage::jittedAsCast() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("jittedAsCast.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QCOMPARE(o->property("running").toBool(), true); + QTRY_COMPARE(o->property("running").toBool(), false); + QCOMPARE(o->property("interval").toInt(), 10); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |