aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2022-10-19 14:35:24 +0200
committerUlf Hermann <[email protected]>2022-11-10 15:00:11 +0100
commit91c6d455595d245445f28d6d1c27c4f2710ef3c3 (patch)
tree87c78aea69c6485e9a18f6ca9cf2fa5830b027c7 /src/qmlcompiler/qqmljsstoragegeneralizer.cpp
parent42065c0e6eba377d775908affdd2a98805712b13 (diff)
QmlCompiler: Allow lists as arguments to methods
Since lists are allowed as property types, you should be able to pass them as arguments to methods, too. For now we only handle QML-defined methods, implemented by adding JavaScript functions to your QML elements. The usual type coercion rules apply if you pass JavaScript arrays to such methods. That is, it usually works. We now resolve properties with the "list" flag to their actual types (QQmlListProperty or QList) already when populating the QQmlJSScope, and store the list types as members of QQmlJSScope rather than as a special map in QQmlJSTypeResolver. This allows us to do the same to lists passed as arguments and simplifies some of the type analysis. Fixes: QTBUG-107171 Change-Id: Idf71ccdc1d59f472c17084a36b5d7879c4d959c0 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qmlcompiler/qqmljsstoragegeneralizer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsstoragegeneralizer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
index 22cfd4c175..ed3743bc61 100644
--- a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
+++ b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
@@ -43,8 +43,10 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run(
const auto transformRegisters
= [&](QFlatMap<int, QQmlJSRegisterContent> &registers) {
- for (auto j = registers.begin(), jEnd = registers.end(); j != jEnd; ++j)
- transformRegister(j.value());
+ for (auto j = registers.begin(), jEnd = registers.end(); j != jEnd; ++j) {
+ QQmlJSRegisterContent &content = j.value();
+ transformRegister(content);
+ }
};
for (QQmlJSRegisterContent &argument : function->argumentTypes) {