diff options
Diffstat (limited to 'src/qml/qml/qqmltypedata_p.h')
-rw-r--r-- | src/qml/qml/qqmltypedata_p.h | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/src/qml/qml/qqmltypedata_p.h b/src/qml/qml/qqmltypedata_p.h index 2c56ede9bd..97419b916b 100644 --- a/src/qml/qml/qqmltypedata_p.h +++ b/src/qml/qml/qqmltypedata_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QQMLTYPEDATA_P_H #define QQMLTYPEDATA_P_H @@ -91,10 +55,7 @@ private: public: ~QQmlTypeData() override; - const QList<ScriptReference> &resolvedScripts() const; - - QV4::ExecutableCompilationUnit *compilationUnit() const; - QV4::ExecutableCompilationUnit *compilationUnitForInlineComponent(unsigned int icObjectId) const; + QV4::CompiledData::CompilationUnit *compilationUnit() const; // Used by QQmlComponent to get notifications struct TypeDataCallback { @@ -105,8 +66,9 @@ public: void registerCallback(TypeDataCallback *); void unregisterCallback(TypeDataCallback *); - CompositeMetaTypeIds typeIds(int objectId = 0) const; + QQmlType qmlType(const QString &inlineComponentName = QString()) const; QByteArray typeClassName() const { return m_typeClassName; } + SourceCodeData backupSourceCode() const { return m_backupSourceCode; } protected: void done() override; @@ -119,27 +81,32 @@ protected: QString stringAt(int index) const override; private: + using InlineComponentData = QV4::CompiledData::InlineComponentData; + bool tryLoadFromDiskCache(); bool loadFromSource(); - void restoreIR(QV4::CompiledData::CompilationUnit &&unit); + void restoreIR(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit); void continueLoadFromIR(); void resolveTypes(); QQmlError buildTypeResolutionCaches( QQmlRefPointer<QQmlTypeNameCache> *typeNameCache, - QV4::ResolvedTypeReferenceMap *resolvedTypeCache + QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypeCache ) const; void compile(const QQmlRefPointer<QQmlTypeNameCache> &typeNameCache, - QV4::ResolvedTypeReferenceMap *resolvedTypeCache, + QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypeCache, const QV4::CompiledData::DependentTypesHasher &dependencyHasher); - void createTypeAndPropertyCaches(const QQmlRefPointer<QQmlTypeNameCache> &typeNameCache, - const QV4::ResolvedTypeReferenceMap &resolvedTypeCache); + QQmlError createTypeAndPropertyCaches( + const QQmlRefPointer<QQmlTypeNameCache> &typeNameCache, + const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache); bool resolveType(const QString &typeName, QTypeRevision &version, TypeReference &ref, int lineNumber = -1, int columnNumber = -1, bool reportErrors = true, QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType, bool *typeRecursionDetected = nullptr); - void scriptImported(const QQmlRefPointer<QQmlScriptBlob> &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override; + void scriptImported( + const QQmlRefPointer<QQmlScriptBlob> &blob, const QV4::CompiledData::Location &location, + const QString &nameSpace, const QString &qualifier) override; SourceCodeData m_backupSourceCode; // used when cache verification fails. QScopedPointer<QmlIR::Document> m_document; @@ -156,16 +123,15 @@ private: QMap<int, TypeReference> m_resolvedTypes; bool m_typesResolved:1; - // Used for self-referencing types, otherwise -1. - CompositeMetaTypeIds m_typeIds; + // Used for self-referencing types, otherwise invalid. + QQmlType m_qmlType; QByteArray m_typeClassName; // used for meta-object later - using ExecutableCompilationUnitPtr = QQmlRefPointer<QV4::ExecutableCompilationUnit>; + using CompilationUnitPtr = QQmlRefPointer<QV4::CompiledData::CompilationUnit>; - QHash<int, InlineComponentData> m_inlineComponentData; + QHash<QString, InlineComponentData> m_inlineComponentData; - ExecutableCompilationUnitPtr m_compiledData; - QHash<int, ExecutableCompilationUnitPtr> m_inlineComponentToCompiledData; + CompilationUnitPtr m_compiledData; QList<TypeDataCallback *> m_callbacks; |