aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-06-26 12:37:56 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-06-27 21:56:31 +0200
commitb9974d82cd134b51bd1833c3e62c7345c8ea2962 (patch)
tree9ec0ca62812dd11d388cd70473015ec6734eb074 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentb1bdad8096a45098d6ac668142493cccfd019579 (diff)
QmlCompiler: Preserve external side effects across jumps
Now that we discern internal and external side effects, we cannot implicitly rely on every jump to generate a side effect anymore. We need to actually update the virtual registers and also merge the side effects (along with other flags). Amends commit 6b14ba5c2fbc2810bb62a87008e338cca571acf6 Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-137540 Change-Id: I6b46c7a4773759c8f6f30308ba72082555ce3e61 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 00c00b4c0f..39292d9dd8 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -184,6 +184,7 @@ private slots:
void mathMinMax();
void mathOperations();
void mathStaticProperties();
+ void mergeSideEffects();
void mergedObjectReadWrite();
void methodOnListLookup();
void methods();
@@ -3712,6 +3713,16 @@ void tst_QmlCppCodegen::mathStaticProperties()
QCOMPARE(object->property("sqrt2").toDouble(), 1.4142135623730951);
}
+void tst_QmlCppCodegen::mergeSideEffects()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/mergeSideEffects.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("c").toInt(), 3);
+}
+
void tst_QmlCppCodegen::mergedObjectReadWrite()
{
QQmlEngine e;