diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-03-01 08:44:28 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-03-01 12:37:40 +0000 |
commit | ae7923fb380834dbe54a5eaa6f20ffaff10fd40c (patch) | |
tree | 4289d9f7b041f31a929774c17b0d57b56b9304a1 /tests | |
parent | 9e14afa9a034e6cf9e34e1e81d6b0cc7509d7568 (diff) |
QmlCompiler: On MoveReg, check if we need to move at all
As we don't store void, null and empty lists, moving those is a noop.
Don't generate invalid code for that.
Change-Id: Ica6714acd0ce8a5ddca44d9a397e776eb3df4247
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 074b66e0073b55d32060ffd542a02c811ad763a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/moveRegVoid.qml | 20 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt index 02e0f06deb..95bc78a96a 100644 --- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt +++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt @@ -86,6 +86,7 @@ set(qml_files math.qml methods.qml modulePrefix.qml + moveRegVoid.qml noBindingLoop.qml noQQmlData.qml nonNotifyable.qml diff --git a/tests/auto/qml/qmlcppcodegen/data/moveRegVoid.qml b/tests/auto/qml/qmlcppcodegen/data/moveRegVoid.qml new file mode 100644 index 0000000000..f1e78babba --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/moveRegVoid.qml @@ -0,0 +1,20 @@ +import QtQuick + +Rectangle { + id: root + property bool translucency: false + + gradient: Gradient { + id: grad + } + + onTranslucencyChanged: { + if (translucency) { + root.color = "transparent"; + root.gradient = null; + } else { + root.color = "white"; + root.gradient = grad; + } + } +} diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 46e0b4fb90..2c53e5da08 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -651,6 +651,7 @@ void tst_QmlCppCodegen::interestingFiles_data() QTest::addRow("curlygrouped") << u"curlygrouped.qml"_qs << true; QTest::addRow("cycleHead") << u"cycleHead.qml"_qs << false; QTest::addRow("deadStoreLoop") << u"deadStoreLoop.qml"_qs << true; + QTest::addRow("moveRegVoid") << u"moveRegVoid.qml"_qs << true; } void tst_QmlCppCodegen::interestingFiles() |