diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-25 01:00:10 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-25 01:00:11 +0100 |
commit | 9893e71cea5de10193376c1733db627ef0783614 (patch) | |
tree | 391fabceb9d4ff6ba5f3ff2c2ec42acb613eb4ef /src/qml/common | |
parent | 87e7203532d69e0aaa0898a972d1d90fa589d519 (diff) | |
parent | e1b4b267aa8c4d9c53e5af4def54f5e9e14e0103 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Icb61522fb41a35303bb3d201b344a0407f67f9a0
Diffstat (limited to 'src/qml/common')
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index 3e5e4ae11e..1480df2817 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE // Also change the comment behind the number to describe the latest change. This has the added // benefit that if another patch changes the version too, it will result in a merge conflict, and // not get removed silently. -#define QV4_DATA_STRUCTURE_VERSION 0x27 // resolved merge +#define QV4_DATA_STRUCTURE_VERSION 0x28// support inline components class QIODevice; class QQmlTypeNameCache; @@ -113,6 +113,7 @@ struct TableIterator int index; const ItemType *operator->() { return (container->*IndexedGetter)(index); } + ItemType operator*() {return *operator->();} void operator++() { ++index; } bool operator==(const TableIterator &rhs) const { return index == rhs.index; } bool operator!=(const TableIterator &rhs) const { return index != rhs.index; } @@ -573,6 +574,15 @@ struct Binding static_assert(sizeof(Binding) == 24, "Binding structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +struct InlineComponent +{ + quint32_le objectIndex; + quint32_le nameIndex; + Location location; +}; + +static_assert(sizeof(InlineComponent) == 12, "InlineComponent structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); + struct EnumValue { quint32_le nameIndex; @@ -697,7 +707,9 @@ struct Object NoFlag = 0x0, IsComponent = 0x1, // object was identified to be an explicit or implicit component boundary HasDeferredBindings = 0x2, // any of the bindings are deferred - HasCustomParserBindings = 0x4 + HasCustomParserBindings = 0x4, + IsInlineComponentRoot = 0x8, + InPartOfInlineComponent = 0x10 }; // Depending on the use, this may be the type name to instantiate before instantiating this @@ -727,12 +739,15 @@ struct Object quint32_le offsetToNamedObjectsInComponent; Location location; Location locationOfIdProperty; + quint32_le offsetToInlineComponents; + quint16_le nInlineComponents; // Function[] // Property[] // Signal[] // Binding[] +// InlineComponent[] - static int calculateSizeExcludingSignalsAndEnums(int nFunctions, int nProperties, int nAliases, int nEnums, int nSignals, int nBindings, int nNamedObjectsInComponent) + static int calculateSizeExcludingSignalsAndEnums(int nFunctions, int nProperties, int nAliases, int nEnums, int nSignals, int nBindings, int nNamedObjectsInComponent, int nInlineComponents) { return ( sizeof(Object) + nFunctions * sizeof(quint32) @@ -742,6 +757,7 @@ struct Object + nSignals * sizeof(quint32) + nBindings * sizeof(Binding) + nNamedObjectsInComponent * sizeof(int) + + nInlineComponents * sizeof(InlineComponent) + 0x7 ) & ~0x7; } @@ -780,11 +796,21 @@ struct Object return reinterpret_cast<const Signal*>(reinterpret_cast<const char*>(this) + offset); } + const InlineComponent *inlineComponentAt(int idx) const + { + return inlineComponentTable() + idx; + } + const quint32_le *namedObjectsInComponentTable() const { return reinterpret_cast<const quint32_le*>(reinterpret_cast<const char *>(this) + offsetToNamedObjectsInComponent); } + const InlineComponent *inlineComponentTable() const + { + return reinterpret_cast<const InlineComponent*>(reinterpret_cast<const char *>(this) + offsetToInlineComponents); + } + // --- QQmlPropertyCacheCreator interface int propertyCount() const { return nProperties; } int aliasCount() const { return nAliases; } @@ -809,17 +835,22 @@ struct Object SignalIterator signalsBegin() const { return SignalIterator(this, 0); } SignalIterator signalsEnd() const { return SignalIterator(this, nSignals); } + typedef TableIterator<InlineComponent, Object, &Object::inlineComponentAt> InlineComponentIterator; + InlineComponentIterator inlineComponentsBegin() const {return InlineComponentIterator(this, 0);} + InlineComponentIterator inlineComponentsEnd() const {return InlineComponentIterator(this, nInlineComponents);} + int namedObjectsInComponentCount() const { return nNamedObjectsInComponent; } // --- }; -static_assert(sizeof(Object) == 68, "Object structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +static_assert(sizeof(Object) == 76, "Object structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct Import { enum ImportType : unsigned int { ImportLibrary = 0x1, ImportFile = 0x2, - ImportScript = 0x3 + ImportScript = 0x3, + ImportInlineComponent = 0x4 }; quint32_le type; @@ -1047,7 +1078,7 @@ struct TypeReferenceMap : QHash<int, TypeReference> } auto prop = obj->propertiesBegin(); - auto propEnd = obj->propertiesEnd(); + auto const propEnd = obj->propertiesEnd(); for ( ; prop != propEnd; ++prop) { if (!prop->isBuiltinType) { TypeReference &r = this->add(prop->builtinTypeOrTypeNameIndex, prop->location); @@ -1056,11 +1087,17 @@ struct TypeReferenceMap : QHash<int, TypeReference> } auto binding = obj->bindingsBegin(); - auto bindingEnd = obj->bindingsEnd(); + auto const bindingEnd = obj->bindingsEnd(); for ( ; binding != bindingEnd; ++binding) { if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) this->add(binding->propertyNameIndex, binding->location); } + + auto ic = obj->inlineComponentsBegin(); + auto const icEnd = obj->inlineComponentsEnd(); + for (; ic != icEnd; ++ic) { + this->add(ic->nameIndex, ic->location); + } } template <typename Iterator> |