diff options
Diffstat (limited to 'src/qml/common')
-rw-r--r-- | src/qml/common/common.pri | 1 | ||||
-rw-r--r-- | src/qml/common/qqmlapiversion_p.h | 2 | ||||
-rw-r--r-- | src/qml/common/qqmljsdiagnosticmessage_p.h | 5 | ||||
-rw-r--r-- | src/qml/common/qqmljssourcelocation_p.h | 85 | ||||
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 78 |
5 files changed, 160 insertions, 11 deletions
diff --git a/src/qml/common/common.pri b/src/qml/common/common.pri index bcc3ea0fa0..b333c0f6d9 100644 --- a/src/qml/common/common.pri +++ b/src/qml/common/common.pri @@ -28,6 +28,7 @@ HEADERS += \ $$PWD/qqmljsdiagnosticmessage_p.h \ $$PWD/qqmljsfixedpoolarray_p.h \ $$PWD/qqmljsmemorypool_p.h \ + $$PWD/qqmljssourcelocation_p.h \ $$PWD/qv4alloca_p.h \ $$PWD/qv4calldata_p.h \ $$PWD/qv4compileddata_p.h \ diff --git a/src/qml/common/qqmlapiversion_p.h b/src/qml/common/qqmlapiversion_p.h index eca05558d8..44d8e3f236 100644 --- a/src/qml/common/qqmlapiversion_p.h +++ b/src/qml/common/qqmlapiversion_p.h @@ -51,6 +51,6 @@ // We mean it. // -#define Q_QML_PRIVATE_API_VERSION 5 +#define Q_QML_PRIVATE_API_VERSION 8 #endif // QQMLAPIVERSION_P_H diff --git a/src/qml/common/qqmljsdiagnosticmessage_p.h b/src/qml/common/qqmljsdiagnosticmessage_p.h index 763332ba76..9f5380ae0c 100644 --- a/src/qml/common/qqmljsdiagnosticmessage_p.h +++ b/src/qml/common/qqmljsdiagnosticmessage_p.h @@ -58,6 +58,8 @@ // QQmlSourceLocation -> line/column change. #include <private/qqmlapiversion_p.h> +#include "qqmljssourcelocation_p.h" + QT_BEGIN_NAMESPACE namespace QQmlJS { @@ -65,8 +67,7 @@ struct DiagnosticMessage { QString message; QtMsgType type = QtCriticalMsg; - quint32 line = 0; - quint32 column = 0; + SourceLocation loc; bool isError() const { diff --git a/src/qml/common/qqmljssourcelocation_p.h b/src/qml/common/qqmljssourcelocation_p.h new file mode 100644 index 0000000000..7c75541eb1 --- /dev/null +++ b/src/qml/common/qqmljssourcelocation_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQMLJSSOURCELOCATION_P_H +#define QQMLJSSOURCELOCATION_P_H + +#include <QtCore/qglobal.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +namespace QQmlJS { + +class SourceLocation +{ +public: + explicit SourceLocation(quint32 offset = 0, quint32 length = 0, quint32 line = 0, quint32 column = 0) + : offset(offset), length(length), + startLine(line), startColumn(column) + { } + + bool isValid() const { return length != 0; } + + quint32 begin() const { return offset; } + quint32 end() const { return offset + length; } + +// attributes + // ### encode + quint32 offset; + quint32 length; + quint32 startLine; + quint32 startColumn; +}; + +} // namespace QQmlJS + +QT_END_NAMESPACE + +#endif diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index 1f5ad9bd86..a5a1cf8969 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -75,7 +75,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 0x25 // Extend size of "register" count (nRegisters) +#define QV4_DATA_STRUCTURE_VERSION 0x29// support additional required property features class QIODevice; class QQmlTypeNameCache; @@ -112,6 +112,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; } @@ -597,6 +598,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; @@ -658,7 +668,8 @@ struct Property { quint32_le nameIndex; union { - quint32_le_bitfield<0, 29> builtinTypeOrTypeNameIndex; + quint32_le_bitfield<0, 28> builtinTypeOrTypeNameIndex; + quint32_le_bitfield<28, 1> isRequired; quint32_le_bitfield<29, 1> isBuiltinType; quint32_le_bitfield<30, 1> isList; quint32_le_bitfield<31, 1> isReadOnly; @@ -684,6 +695,12 @@ struct Property }; static_assert(sizeof(Property) == 12, "Property structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +struct RequiredPropertyExtraData { + quint32_le nameIndex; +}; + +static_assert (sizeof(RequiredPropertyExtraData) == 4, "RequiredPropertyExtraData structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); + struct Alias { enum Flags : unsigned int { IsReadOnly = 0x1, @@ -720,7 +737,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 @@ -750,12 +769,18 @@ struct Object quint32_le offsetToNamedObjectsInComponent; Location location; Location locationOfIdProperty; + quint32_le offsetToInlineComponents; + quint16_le nInlineComponents; + quint32_le offsetToRequiredPropertyExtraData; + quint16_le nRequiredPropertyExtraData; // Function[] // Property[] // Signal[] // Binding[] +// InlineComponent[] +// RequiredPropertyExtraData[] - 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, int nRequiredPropertyExtraData) { return ( sizeof(Object) + nFunctions * sizeof(quint32) @@ -765,6 +790,8 @@ struct Object + nSignals * sizeof(quint32) + nBindings * sizeof(Binding) + nNamedObjectsInComponent * sizeof(int) + + nInlineComponents * sizeof(InlineComponent) + + nRequiredPropertyExtraData * sizeof(RequiredPropertyExtraData) + 0x7 ) & ~0x7; } @@ -803,11 +830,31 @@ 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); + } + + const RequiredPropertyExtraData *requiredPropertyExtraDataAt(int idx) const + { + return requiredPropertyExtraDataTable() + idx; + } + + const RequiredPropertyExtraData *requiredPropertyExtraDataTable() const + { + return reinterpret_cast<const RequiredPropertyExtraData*>(reinterpret_cast<const char *>(this) + offsetToRequiredPropertyExtraData); + } + // --- QQmlPropertyCacheCreator interface int propertyCount() const { return nProperties; } int aliasCount() const { return nAliases; } @@ -832,17 +879,26 @@ 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);} + + typedef TableIterator<RequiredPropertyExtraData, Object, &Object::requiredPropertyExtraDataAt> RequiredPropertyExtraDataIterator; + RequiredPropertyExtraDataIterator requiredPropertyExtraDataBegin() const {return RequiredPropertyExtraDataIterator(this, 0); }; + RequiredPropertyExtraDataIterator requiredPropertyExtraDataEnd() const {return RequiredPropertyExtraDataIterator(this, nRequiredPropertyExtraData); }; + 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) == 84, "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; @@ -1071,7 +1127,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); @@ -1080,11 +1136,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> |