From b9974d82cd134b51bd1833c3e62c7345c8ea2962 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 26 Jun 2025 12:37:56 +0200 Subject: QmlCompiler: Preserve external side effects across jumps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Olivier De Cannière --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') 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 o(c.create()); + QVERIFY(!o.isNull()); + QCOMPARE(o->property("c").toInt(), 3); +} + void tst_QmlCppCodegen::mergedObjectReadWrite() { QQmlEngine e; -- cgit v1.2.3