Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/compiler/qqmltypecompiler_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count |
---|---|---|
1 | - | |
2 | - | |
3 | - | |
4 | class QQmlEnginePrivate; | - |
5 | class QQmlError; | - |
6 | class QQmlTypeData; | - |
7 | class QQmlImports; | - |
8 | - | |
9 | namespace QmlIR { | - |
10 | struct Document; | - |
11 | } | - |
12 | - | |
13 | namespace QV4 { | - |
14 | namespace CompiledData { | - |
15 | struct QmlUnit; | - |
16 | struct Location; | - |
17 | } | - |
18 | } | - |
19 | - | |
20 | struct QQmlTypeCompiler | - |
21 | { | - |
22 | public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlTypeCompiler", sourceText, disambiguation, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlTypeCompiler", sourceText, disambiguation, n); } private: | - |
23 | public: | - |
24 | QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlTypeData *typeData, QmlIR::Document *document, const QQmlRefPointer<QQmlTypeNameCache> &typeNameCache, const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache, | - |
25 | const QV4::CompiledData::DependentTypesHasher &dependencyHasher); | - |
26 | - | |
27 | - | |
28 | typedef QmlIR::Object CompiledObject; | - |
29 | const QmlIR::Object *objectAt(int index) const { return executed 71753 times by 141 tests: document->objects.at(index);return document->objects.at(index); Executed by:
executed 71753 times by 141 tests: }return document->objects.at(index); Executed by:
| 71753 |
30 | int objectCount() const { return executed 48461 times by 141 tests: document->objects.count();return document->objects.count(); Executed by:
executed 48461 times by 141 tests: }return document->objects.count(); Executed by:
| 48461 |
31 | QString stringAt(int idx) const; | - |
32 | QmlIR::PoolList<QmlIR::Function>::Iterator objectFunctionsBegin(const QmlIR::Object *object) const { return executed 4594 times by 101 tests: object->functionsBegin();return object->functionsBegin(); Executed by:
executed 4594 times by 101 tests: }return object->functionsBegin(); Executed by:
| 4594 |
33 | QmlIR::PoolList<QmlIR::Function>::Iterator objectFunctionsEnd(const QmlIR::Object *object) const { return executed 4594 times by 101 tests: object->functionsEnd();return object->functionsEnd(); Executed by:
executed 4594 times by 101 tests: }return object->functionsEnd(); Executed by:
| 4594 |
34 | QV4::CompiledData::ResolvedTypeReferenceMap resolvedTypes; | - |
35 | - | |
36 | - | |
37 | QQmlRefPointer<QV4::CompiledData::CompilationUnit> compile(); | - |
38 | - | |
39 | QList<QQmlError> compilationErrors() const { return executed 8 times by 2 tests: errors;return errors; Executed by:
executed 8 times by 2 tests: }return errors; Executed by:
| 8 |
40 | void recordError(QQmlError error); | - |
41 | void recordError(const QV4::CompiledData::Location &location, const QString &description); | - |
42 | void recordError(const QQmlCompileError &error); | - |
43 | - | |
44 | int registerString(const QString &str); | - |
45 | - | |
46 | const QV4::CompiledData::Unit *qmlUnit() const; | - |
47 | - | |
48 | QUrl url() const { return executed 3835 times by 95 tests: typeData->finalUrl();return typeData->finalUrl(); Executed by:
executed 3835 times by 95 tests: }return typeData->finalUrl(); Executed by:
| 3835 |
49 | QQmlEnginePrivate *enginePrivate() const { return executed 146726 times by 141 tests: engine;return engine; Executed by:
executed 146726 times by 141 tests: }return engine; Executed by:
| 146726 |
50 | const QQmlImports *imports() const; | - |
51 | QVector<QmlIR::Object *> *qmlObjects() const; | - |
52 | void setPropertyCaches(QQmlPropertyCacheVector &&caches); | - |
53 | const QQmlPropertyCacheVector *propertyCaches() const; | - |
54 | QQmlPropertyCacheVector &&takePropertyCaches(); | - |
55 | void setComponentRoots(const QVector<quint32> &roots) { m_componentRoots = roots; } executed 48455 times by 141 tests: end of block Executed by:
| 48455 |
56 | const QVector<quint32> &componentRoots() const { return executed 48431 times by 140 tests: m_componentRoots;return m_componentRoots; Executed by:
executed 48431 times by 140 tests: }return m_componentRoots; Executed by:
| 48431 |
57 | QQmlJS::MemoryPool *memoryPool(); | - |
58 | QStringRef newStringRef(const QString &string); | - |
59 | const QV4::Compiler::StringTableGenerator *stringPool() const; | - |
60 | void setBindingPropertyDataPerObject(const QVector<QV4::CompiledData::BindingPropertyData> &propertyData); | - |
61 | - | |
62 | const QHash<int, QQmlCustomParser*> &customParserCache() const { return executed 193800 times by 141 tests: customParsers;return customParsers; Executed by:
executed 193800 times by 141 tests: }return customParsers; Executed by:
| 193800 |
63 | - | |
64 | QString bindingAsString(const QmlIR::Object *object, int scriptIndex) const; | - |
65 | - | |
66 | void addImport(const QString &module, const QString &qualifier, int majorVersion, int minorVersion); | - |
67 | - | |
68 | private: | - |
69 | QList<QQmlError> errors; | - |
70 | QQmlEnginePrivate *engine; | - |
71 | QQmlTypeData *typeData; | - |
72 | const QV4::CompiledData::DependentTypesHasher &dependencyHasher; | - |
73 | QQmlRefPointer<QQmlTypeNameCache> typeNameCache; | - |
74 | QmlIR::Document *document; | - |
75 | - | |
76 | QHash<int, QQmlCustomParser*> customParsers; | - |
77 | - | |
78 | - | |
79 | QVector<quint32> m_componentRoots; | - |
80 | QQmlPropertyCacheVector m_propertyCaches; | - |
81 | }; | - |
82 | - | |
83 | struct QQmlCompilePass | - |
84 | { | - |
85 | QQmlCompilePass(QQmlTypeCompiler *typeCompiler); | - |
86 | - | |
87 | QString stringAt(int idx) const { return executed 628669 times by 141 tests: compiler->stringAt(idx);return compiler->stringAt(idx); Executed by:
executed 628669 times by 141 tests: }return compiler->stringAt(idx); Executed by:
| 628669 |
88 | protected: | - |
89 | void recordError(const QV4::CompiledData::Location &location, const QString &description) const | - |
90 | { compiler->recordError(location, description); } executed 4 times by 1 test: end of block Executed by:
| 4 |
91 | void recordError(const QQmlCompileError &error) | - |
92 | { compiler->recordError(error); } never executed: end of block | 0 |
93 | - | |
94 | QQmlTypeCompiler *compiler; | - |
95 | }; | - |
96 | - | |
97 | - | |
98 | - | |
99 | - | |
100 | - | |
101 | struct SignalHandlerConverter : public QQmlCompilePass | - |
102 | { | - |
103 | public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("SignalHandlerConverter", sourceText, disambiguation, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("SignalHandlerConverter", sourceText, disambiguation, n); } private: | - |
104 | public: | - |
105 | SignalHandlerConverter(QQmlTypeCompiler *typeCompiler); | - |
106 | - | |
107 | bool convertSignalHandlerExpressionsToFunctionDeclarations(); | - |
108 | - | |
109 | private: | - |
110 | bool convertSignalHandlerExpressionsToFunctionDeclarations(const QmlIR::Object *obj, const QString &typeName, QQmlPropertyCache *propertyCache); | - |
111 | - | |
112 | QQmlEnginePrivate *enginePrivate; | - |
113 | const QVector<QmlIR::Object*> &qmlObjects; | - |
114 | const QQmlImports *imports; | - |
115 | const QHash<int, QQmlCustomParser*> &customParsers; | - |
116 | const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypes; | - |
117 | const QSet<QString> &illegalNames; | - |
118 | const QQmlPropertyCacheVector * const propertyCaches; | - |
119 | }; | - |
120 | - | |
121 | - | |
122 | - | |
123 | - | |
124 | class QQmlEnumTypeResolver : public QQmlCompilePass | - |
125 | { | - |
126 | public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlEnumTypeResolver", sourceText, disambiguation, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlEnumTypeResolver", sourceText, disambiguation, n); } private: | - |
127 | public: | - |
128 | QQmlEnumTypeResolver(QQmlTypeCompiler *typeCompiler); | - |
129 | - | |
130 | bool resolveEnumBindings(); | - |
131 | - | |
132 | private: | - |
133 | bool assignEnumToBinding(QmlIR::Binding *binding, const QStringRef &enumName, int enumValue, bool isQtObject); | - |
134 | bool assignEnumToBinding(QmlIR::Binding *binding, const QString &enumName, int enumValue, bool isQtObject) | - |
135 | { | - |
136 | return never executed: assignEnumToBinding(binding, QStringRef(&enumName), enumValue, isQtObject);return assignEnumToBinding(binding, QStringRef(&enumName), enumValue, isQtObject); never executed: return assignEnumToBinding(binding, QStringRef(&enumName), enumValue, isQtObject); | 0 |
137 | } | - |
138 | bool tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache, | - |
139 | const QQmlPropertyData *prop, | - |
140 | QmlIR::Binding *binding); | - |
141 | int evaluateEnum(const QString &scope, const QStringRef &enumName, const QStringRef &enumValue, bool *ok) const; | - |
142 | - | |
143 | - | |
144 | const QVector<QmlIR::Object*> &qmlObjects; | - |
145 | const QQmlPropertyCacheVector * const propertyCaches; | - |
146 | const QQmlImports *imports; | - |
147 | QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypes; | - |
148 | }; | - |
149 | - | |
150 | class QQmlCustomParserScriptIndexer: public QQmlCompilePass | - |
151 | { | - |
152 | public: | - |
153 | QQmlCustomParserScriptIndexer(QQmlTypeCompiler *typeCompiler); | - |
154 | - | |
155 | void annotateBindingsWithScriptStrings(); | - |
156 | - | |
157 | private: | - |
158 | void scanObjectRecursively(int objectIndex, bool annotateScriptBindings = false); | - |
159 | - | |
160 | const QVector<QmlIR::Object*> &qmlObjects; | - |
161 | const QHash<int, QQmlCustomParser*> &customParsers; | - |
162 | }; | - |
163 | - | |
164 | - | |
165 | class QQmlAliasAnnotator : public QQmlCompilePass | - |
166 | { | - |
167 | public: | - |
168 | QQmlAliasAnnotator(QQmlTypeCompiler *typeCompiler); | - |
169 | - | |
170 | void annotateBindingsToAliases(); | - |
171 | private: | - |
172 | const QVector<QmlIR::Object*> &qmlObjects; | - |
173 | const QQmlPropertyCacheVector * const propertyCaches; | - |
174 | }; | - |
175 | - | |
176 | class QQmlScriptStringScanner : public QQmlCompilePass | - |
177 | { | - |
178 | public: | - |
179 | QQmlScriptStringScanner(QQmlTypeCompiler *typeCompiler); | - |
180 | - | |
181 | void scan(); | - |
182 | - | |
183 | private: | - |
184 | const QVector<QmlIR::Object*> &qmlObjects; | - |
185 | const QQmlPropertyCacheVector * const propertyCaches; | - |
186 | }; | - |
187 | - | |
188 | class QQmlComponentAndAliasResolver : public QQmlCompilePass | - |
189 | { | - |
190 | public: static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlAnonymousComponentResolver", sourceText, disambiguation, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) { return QCoreApplication::translate("QQmlAnonymousComponentResolver", sourceText, disambiguation, n); } private: | - |
191 | public: | - |
192 | QQmlComponentAndAliasResolver(QQmlTypeCompiler *typeCompiler); | - |
193 | - | |
194 | bool resolve(); | - |
195 | - | |
196 | protected: | - |
197 | void findAndRegisterImplicitComponents(const QmlIR::Object *obj, QQmlPropertyCache *propertyCache); | - |
198 | bool collectIdsAndAliases(int objectIndex); | - |
199 | bool resolveAliases(int componentIndex); | - |
200 | void propertyDataForAlias(QmlIR::Alias *alias, int *type, quint32 *propertyFlags); | - |
201 | - | |
202 | enum AliasResolutionResult { | - |
203 | NoAliasResolved, | - |
204 | SomeAliasesResolved, | - |
205 | AllAliasesResolved | - |
206 | }; | - |
207 | - | |
208 | AliasResolutionResult resolveAliasesInObject(int objectIndex, QQmlCompileError *error); | - |
209 | - | |
210 | QQmlEnginePrivate *enginePrivate; | - |
211 | QQmlJS::MemoryPool *pool; | - |
212 | - | |
213 | QVector<QmlIR::Object*> *qmlObjects; | - |
214 | - | |
215 | - | |
216 | QVector<quint32> componentRoots; | - |
217 | - | |
218 | - | |
219 | QMap<int, int> _idToObjectIndex; | - |
220 | QVector<int> _objectsWithAliases; | - |
221 | - | |
222 | QV4::CompiledData::ResolvedTypeReferenceMap *resolvedTypes; | - |
223 | QQmlPropertyCacheVector propertyCaches; | - |
224 | }; | - |
225 | - | |
226 | class QQmlDeferredAndCustomParserBindingScanner : public QQmlCompilePass | - |
227 | { | - |
228 | public: | - |
229 | QQmlDeferredAndCustomParserBindingScanner(QQmlTypeCompiler *typeCompiler); | - |
230 | - | |
231 | bool scanObject(); | - |
232 | - | |
233 | private: | - |
234 | bool scanObject(int objectIndex); | - |
235 | - | |
236 | QVector<QmlIR::Object*> *qmlObjects; | - |
237 | const QQmlPropertyCacheVector * const propertyCaches; | - |
238 | const QHash<int, QQmlCustomParser*> &customParsers; | - |
239 | - | |
240 | bool _seenObjectWithId; | - |
241 | }; | - |
242 | - | |
243 | - | |
244 | class QQmlJSCodeGenerator : public QQmlCompilePass | - |
245 | { | - |
246 | public: | - |
247 | QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QmlIR::JSCodeGen *v4CodeGen); | - |
248 | - | |
249 | bool generateCodeForComponents(); | - |
250 | - | |
251 | private: | - |
252 | bool compileComponent(int componentRoot); | - |
253 | bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex); | - |
254 | - | |
255 | const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypes; | - |
256 | const QHash<int, QQmlCustomParser*> &customParsers; | - |
257 | const QVector<QmlIR::Object*> &qmlObjects; | - |
258 | const QQmlPropertyCacheVector * const propertyCaches; | - |
259 | QmlIR::JSCodeGen * const v4CodeGen; | - |
260 | }; | - |
261 | - | |
262 | class QQmlDefaultPropertyMerger : public QQmlCompilePass | - |
263 | { | - |
264 | public: | - |
265 | QQmlDefaultPropertyMerger(QQmlTypeCompiler *typeCompiler); | - |
266 | - | |
267 | void mergeDefaultProperties(); | - |
268 | - | |
269 | private: | - |
270 | void mergeDefaultProperties(int objectIndex); | - |
271 | - | |
272 | const QVector<QmlIR::Object*> &qmlObjects; | - |
273 | const QQmlPropertyCacheVector * const propertyCaches; | - |
274 | }; | - |
275 | - | |
276 | - | |
Switch to Source code | Preprocessed file |