32 Q_DECLARE_TR_FUNCTIONS(QQmlTypeData)
39 QQmlRefPointer<QQmlTypeData> typeData;
40 QV4::CompiledData::Location location;
41 QTypeRevision version = QTypeRevision::zero();
42 bool selfReference =
false;
43 bool needsCreation =
true;
45 QString qualifiedName()
const;
48 struct ScriptReference
51 QQmlRefPointer<QQmlScriptBlob> script;
52 QV4::CompiledData::Location location;
56 friend class QQmlTypeLoader;
59 QQmlTypeData(
const QUrl &, QQmlTypeLoader *);
60 ~QQmlTypeData() override;
62 QV4::CompiledData::CompilationUnit *compilationUnit()
const;
64 QQmlType qmlType(
const QString &inlineComponentName = QString())
const;
65 QByteArray typeClassName()
const {
return m_typeClassName; }
66 SourceCodeData backupSourceCode()
const {
return m_backupSourceCode; }
71 void dataReceived(
const SourceCodeData &) override;
72 void initializeFromCachedUnit(
const QQmlPrivate::CachedQmlUnit *unit) override;
73 void allDependenciesDone() override;
75 QString stringAt(
int index)
const override;
78 using InlineComponentData = QV4::CompiledData::InlineComponentData;
80 bool tryLoadFromDiskCache();
81 bool loadFromDiskCache(
const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit);
82 bool loadFromSource();
83 void continueLoadFromIR();
85 QQmlError buildTypeResolutionCaches(
86 QQmlRefPointer<QQmlTypeNameCache> *typeNameCache,
87 QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypeCache
89 void saveToDiskCache();
90 void persistRuntimeData();
91 void compile(QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypeCache);
92 QQmlError createTypeAndPropertyCaches(
93 const QQmlRefPointer<QQmlTypeNameCache> &typeNameCache,
94 const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache);
95 bool resolveType(
const QString &typeName, QQmlImportResolutionResult *result,
96 TypeReference &ref,
int lineNumber = -1,
int columnNumber = -1,
97 bool reportErrors =
true,
98 QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType,
99 QQmlImport::RecursionRestriction recursionRestriction
100 = QQmlImport::PreventRecursion);
103 const QQmlRefPointer<QQmlScriptBlob> &blob,
const QV4::CompiledData::Location &location,
104 const QString &nameSpace,
const QString &qualifier) override;
106 SourceCodeData m_backupSourceCode;
107 QScopedPointer<QmlIR::Document> m_document;
108 QV4::CompiledData::TypeReferenceMap m_typeReferences;
110 QList<ScriptReference> m_scripts;
112 QSet<QString> m_namespaces;
113 QList<TypeReference> m_compositeSingletons;
118 QMap<
int, TypeReference> m_resolvedTypes;
119 bool m_typesResolved:1;
123 QByteArray m_typeClassName;
125 using CompilationUnitPtr = QQmlRefPointer<QV4::CompiledData::CompilationUnit>;
127 QHash<QString, InlineComponentData> m_inlineComponentData;
129 CompilationUnitPtr m_compiledData;
131 bool m_implicitImportLoaded;
132 bool loadImplicitImport();
134 bool checkDependencies();
136 template<
typename Reference>
137 void createError(
const Reference &ref,
const QString &message, QList<QQmlError> errors)
141 error.setLine(qmlConvertSourceCoordinate<quint32,
int>(ref.location.line()));
142 error.setColumn(qmlConvertSourceCoordinate<quint32,
int>(ref.location.column()));
143 error.setDescription(message);
144 errors.prepend(std::move(error));
148 void createError(
const TypeReference &type,
const QString &message);
149 void createError(
const ScriptReference &script,
const QString &message);
151 bool checkCompositeSingletons();
152 void createQQmlType();