diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-24 18:21:15 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-25 10:51:47 +0100 |
commit | 3f0c9122c5971090d0256bda4e9fb53da4a76ea0 (patch) | |
tree | ca51902e6fb457e61da574d55ebee72d7a28ca7a /src/qml/qml/qqmlobjectcreator.cpp | |
parent | d9eeab6e2c699761115d9acbca292c16762eb8f3 (diff) |
Encapsulate QV4::ResolvedTypeReference
It's used all over the place. We need a proper interface.
Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index d43b351a50..213e15e173 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -59,6 +59,7 @@ #include <private/qqmlsourcecoordinate_p.h> #include <private/qjsvalue_p.h> #include <private/qv4generatorobject_p.h> +#include <private/qv4resolvedtypereference_p.h> #include <QScopedValueRollback> @@ -815,7 +816,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *bindingProper Q_ASSERT(stringAt(compilationUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex).isEmpty()); QV4::ResolvedTypeReference *tr = resolvedType(binding->propertyNameIndex); Q_ASSERT(tr); - QQmlType attachedType = tr->type; + QQmlType attachedType = tr->type(); if (!attachedType.isValid()) { QQmlTypeNameCache::Result res = context->imports()->query( stringAt(binding->propertyNameIndex)); @@ -1192,8 +1193,8 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo } else { QV4::ResolvedTypeReference *typeRef = resolvedType(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); - installPropertyCache = !typeRef->isFullyDynamicType; - QQmlType type = typeRef->type; + installPropertyCache = !typeRef->isFullyDynamicType(); + const QQmlType type = typeRef->type(); if (type.isValid() && !type.isInlineComponentType()) { typeName = type.qmlTypeName(); @@ -1226,19 +1227,18 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo sharedState->allCreatedObjects.push(instance); } else { - Q_ASSERT(typeRef->compilationUnit); - typeName = typeRef->compilationUnit->fileName(); + const auto compilationUnit = typeRef->compilationUnit(); + Q_ASSERT(compilationUnit); + typeName = compilationUnit->fileName(); // compilation unit is shared between root type and its inline component types // so isSingleton errorneously returns true for inline components - if (typeRef->compilationUnit->unitData()->isSingleton() && !type.isInlineComponentType()) - { + if (compilationUnit->unitData()->isSingleton() && !type.isInlineComponentType()) { recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex))); return nullptr; } - if (!type.isInlineComponentType()) { - QQmlObjectCreator subCreator(context, typeRef->compilationUnit, sharedState.data()); + QQmlObjectCreator subCreator(context, compilationUnit, sharedState.data()); instance = subCreator.create(); if (!instance) { errors += subCreator.errors; @@ -1246,8 +1246,8 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo } } else { int subObjectId = type.inlineComponentId(); - QScopedValueRollback<int> rollback {typeRef->compilationUnit->icRoot, subObjectId}; - QQmlObjectCreator subCreator(context, typeRef->compilationUnit, sharedState.data()); + QScopedValueRollback<int> rollback {compilationUnit->icRoot, subObjectId}; + QQmlObjectCreator subCreator(context, compilationUnit, sharedState.data()); instance = subCreator.create(subObjectId, nullptr, nullptr, CreationFlags::InlineComponent); if (!instance) { errors += subCreator.errors; |