summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4function.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-12-02 13:56:20 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-12-15 17:47:58 +0100
commitc4fc1167188cde9e89d44a8e5e02c5b1e04c61a7 (patch)
tree8d2ff74980203ce361e8a18dc7eb3a7de7d733c3 /src/qml/jsruntime/qv4function.cpp
parentb13e22f2745562d0549461c85cfee1bbada631ce (diff)
downloadqtdeclarative-c4fc1167188cde9e89d44a8e5e02c5b1e04c61a7.tar.gz
QmlCompiler: Fix recognition of builtin list types
Previously all list types used as arguments or return types for methods had to be looked up via the imports. However, builtin types are not part of the imports at run time. Therefore, recognize list types already early on, when generating the IR. This is the same way we do it for property types and it allows us to easily identify lists of builtins. Pick-to: 6.5 Fixes: QTBUG-109147 Change-Id: I91fa9c8fc99c1e0155cc5db5faddd928ca7fabbc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r--src/qml/jsruntime/qv4function.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index 34b548113d..29e3d8d7ef 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -139,12 +139,16 @@ Function::Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(engine->qmlEngine());
auto findMetaType = [&](const CompiledData::ParameterType &param) {
+ const quint32 type = param.typeNameIndexOrBuiltinType();
if (param.indexIsBuiltinType()) {
+ if (param.isList()) {
+ return QQmlPropertyCacheCreatorBase::listTypeForPropertyType(
+ QV4::CompiledData::BuiltinType(type));
+ }
return QQmlPropertyCacheCreatorBase::metaTypeForPropertyType(
- QV4::CompiledData::BuiltinType(param.typeNameIndexOrBuiltinType()));
+ QV4::CompiledData::BuiltinType(type));
}
- const quint32 type = param.typeNameIndexOrBuiltinType();
if (type == 0)
return QMetaType();
@@ -152,18 +156,21 @@ Function::Function(ExecutionEngine *engine, ExecutableCompilationUnit *unit,
if (!qmltype.isValid())
return QMetaType();
- const QMetaType metaType = qmltype.typeId();
+ const QMetaType metaType = param.isList() ? qmltype.qListTypeId() : qmltype.typeId();
if (metaType.isValid())
return metaType;
if (!qmltype.isComposite()) {
- return qmltype.isInlineComponentType()
- ? unit->typeIdsForComponent(qmltype.inlineComponentId()).id
- : QMetaType();
+ if (!qmltype.isInlineComponentType())
+ return QMetaType();
+ const CompositeMetaTypeIds typeIds
+ = unit->typeIdsForComponent(qmltype.inlineComponentId());
+ return param.isList() ? typeIds.listId : typeIds.id;
}
- return enginePrivate->typeLoader.getType(
- qmltype.sourceUrl())->compilationUnit()->typeIds.id;
+ const CompositeMetaTypeIds typeIds = enginePrivate->typeLoader.getType(
+ qmltype.sourceUrl())->compilationUnit()->typeIds;
+ return param.isList() ? typeIds.listId : typeIds.id;
};
for (quint16 i = 0; i < nFormals; ++i)