From ae76c8f428e9ca7ac5d398b51ffdb03407a26f04 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 2 Jul 2024 10:43:06 +0200 Subject: QmlCompiler: Fix side effect detection for array methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Array methods that manipulate the array they are called on always have side effects, on that array. In order to optimize them out we'd have to do some more involved tracking of affected values. Amends commit e84686415187455a7153d61ca82478053f13e3f9 Fixes: QTBUG-126834 Pick-to: 6.8 6.7 Change-Id: Ia4395ea21e89590e6ffe95e236f70b5e64402f5e Reviewed-by: Olivier De Cannière Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 2 ++ 1 file changed, 2 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 21d649a690..22479d3d9c 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -2752,6 +2752,8 @@ void tst_QmlCppCodegen::jsArrayMethods() QCOMPARE(object->property("listPropertyLastIndexOf"), object->property("jsArrayLastIndexOf")); QCOMPARE(object->property("listPropertyLastIndexOf").toInt(), 5); + + QCOMPARE(check->property("pushAndJoin").toString(), QStringLiteral("A+B")); } void tst_QmlCppCodegen::jsArrayMethodsWithParams() -- cgit v1.2.3