Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmltypewrapper.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | using namespace QV4; | - | ||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | const QV4::VTable QQmlTypeWrapper::static_vtbl = { (std::is_same<QQmlTypeWrapper::SuperClass, Object>::value) ? nullptr : &QQmlTypeWrapper::SuperClass::static_vtbl, (sizeof(QQmlTypeWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(QQmlTypeWrapper::Data) + (QQmlTypeWrapper::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(QQmlTypeWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), QQmlTypeWrapper::IsExecutionContext, QQmlTypeWrapper::IsString, QQmlTypeWrapper::IsObject, QQmlTypeWrapper::IsFunctionObject, QQmlTypeWrapper::IsErrorObject, QQmlTypeWrapper::IsArrayData, QQmlTypeWrapper::IsStringOrSymbol, QQmlTypeWrapper::MyType, { 0, 0, 0, 0 }, "QQmlTypeWrapper", QQmlTypeWrapper::virtualDestroy, QQmlTypeWrapper::Data::markObjects, QQmlTypeWrapper::virtualIsEqualTo, QQmlTypeWrapper::virtualGet, QQmlTypeWrapper::virtualPut, QQmlTypeWrapper::virtualDeleteProperty, QQmlTypeWrapper::virtualHasProperty, QQmlTypeWrapper::virtualGetOwnProperty, QQmlTypeWrapper::virtualDefineOwnProperty, QQmlTypeWrapper::virtualIsExtensible, QQmlTypeWrapper::virtualPreventExtensions, QQmlTypeWrapper::virtualGetPrototypeOf, QQmlTypeWrapper::virtualSetPrototypeOf, QQmlTypeWrapper::virtualGetLength, QQmlTypeWrapper::virtualAdvanceIterator, QQmlTypeWrapper::virtualInstanceOf, QQmlTypeWrapper::virtualCall, QQmlTypeWrapper::virtualCallAsConstructor, }; | - | ||||||||||||||||||||||||
9 | const QV4::VTable QQmlScopedEnumWrapper::static_vtbl = { (std::is_same<QQmlScopedEnumWrapper::SuperClass, Object>::value) ? nullptr : &QQmlScopedEnumWrapper::SuperClass::static_vtbl, (sizeof(QQmlScopedEnumWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(QQmlScopedEnumWrapper::Data) + (QQmlScopedEnumWrapper::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(QQmlScopedEnumWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), QQmlScopedEnumWrapper::IsExecutionContext, QQmlScopedEnumWrapper::IsString, QQmlScopedEnumWrapper::IsObject, QQmlScopedEnumWrapper::IsFunctionObject, QQmlScopedEnumWrapper::IsErrorObject, QQmlScopedEnumWrapper::IsArrayData, QQmlScopedEnumWrapper::IsStringOrSymbol, QQmlScopedEnumWrapper::MyType, { 0, 0, 0, 0 }, "QQmlScopedEnumWrapper", QQmlScopedEnumWrapper::virtualDestroy, QQmlScopedEnumWrapper::Data::markObjects, QQmlScopedEnumWrapper::virtualIsEqualTo, QQmlScopedEnumWrapper::virtualGet, QQmlScopedEnumWrapper::virtualPut, QQmlScopedEnumWrapper::virtualDeleteProperty, QQmlScopedEnumWrapper::virtualHasProperty, QQmlScopedEnumWrapper::virtualGetOwnProperty, QQmlScopedEnumWrapper::virtualDefineOwnProperty, QQmlScopedEnumWrapper::virtualIsExtensible, QQmlScopedEnumWrapper::virtualPreventExtensions, QQmlScopedEnumWrapper::virtualGetPrototypeOf, QQmlScopedEnumWrapper::virtualSetPrototypeOf, QQmlScopedEnumWrapper::virtualGetLength, QQmlScopedEnumWrapper::virtualAdvanceIterator, QQmlScopedEnumWrapper::virtualInstanceOf, QQmlScopedEnumWrapper::virtualCall, QQmlScopedEnumWrapper::virtualCallAsConstructor, }; | - | ||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | void Heap::QQmlTypeWrapper::init() | - | ||||||||||||||||||||||||
12 | { | - | ||||||||||||||||||||||||
13 | Object::init(); | - | ||||||||||||||||||||||||
14 | mode = IncludeEnums; | - | ||||||||||||||||||||||||
15 | object.init(); | - | ||||||||||||||||||||||||
16 | } executed 149836 times by 42 tests: end of block Executed by:
| 149836 | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | void Heap::QQmlTypeWrapper::destroy() | - | ||||||||||||||||||||||||
19 | { | - | ||||||||||||||||||||||||
20 | QQmlType::derefHandle(typePrivate); | - | ||||||||||||||||||||||||
21 | typePrivate = nullptr; | - | ||||||||||||||||||||||||
22 | if (typeNamespace
| 324-149504 | ||||||||||||||||||||||||
23 | typeNamespace->release(); executed 324 times by 5 tests: typeNamespace->release(); Executed by:
| 324 | ||||||||||||||||||||||||
24 | object.destroy(); | - | ||||||||||||||||||||||||
25 | Object::destroy(); | - | ||||||||||||||||||||||||
26 | } executed 149828 times by 42 tests: end of block Executed by:
| 149828 | ||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||
28 | QQmlType Heap::QQmlTypeWrapper::type() const | - | ||||||||||||||||||||||||
29 | { | - | ||||||||||||||||||||||||
30 | return executed 149874 times by 42 tests: QQmlType(typePrivate);return QQmlType(typePrivate); Executed by:
executed 149874 times by 42 tests: return QQmlType(typePrivate); Executed by:
| 149874 | ||||||||||||||||||||||||
31 | } | - | ||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||
33 | bool QQmlTypeWrapper::isSingleton() const | - | ||||||||||||||||||||||||
34 | { | - | ||||||||||||||||||||||||
35 | return executed 32 times by 2 tests: d()->type().isSingleton();return d()->type().isSingleton(); Executed by:
executed 32 times by 2 tests: return d()->type().isSingleton(); Executed by:
| 32 | ||||||||||||||||||||||||
36 | } | - | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | QObject* QQmlTypeWrapper::singletonObject() const | - | ||||||||||||||||||||||||
39 | { | - | ||||||||||||||||||||||||
40 | if (!isSingleton()
| 0 | ||||||||||||||||||||||||
41 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | QQmlEngine *e = engine()->qmlEngine(); | - | ||||||||||||||||||||||||
44 | QQmlType::SingletonInstanceInfo *siinfo = d()->type().singletonInstanceInfo(); | - | ||||||||||||||||||||||||
45 | siinfo->init(e); | - | ||||||||||||||||||||||||
46 | return never executed: siinfo->qobjectApi(e);return siinfo->qobjectApi(e); never executed: return siinfo->qobjectApi(e); | 0 | ||||||||||||||||||||||||
47 | } | - | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | QVariant QQmlTypeWrapper::toVariant() const | - | ||||||||||||||||||||||||
50 | { | - | ||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||
52 | if (!isSingleton()
| 0-30 | ||||||||||||||||||||||||
53 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||
55 | QQmlEngine *e = engine()->qmlEngine(); | - | ||||||||||||||||||||||||
56 | QQmlType::SingletonInstanceInfo *siinfo = d()->type().singletonInstanceInfo(); | - | ||||||||||||||||||||||||
57 | siinfo->init(e); | - | ||||||||||||||||||||||||
58 | if (QObject *qobjectSingleton = siinfo->qobjectApi(e)
| 0-30 | ||||||||||||||||||||||||
59 | return executed 30 times by 2 tests: QVariant::fromValue<QObject*>(qobjectSingleton);return QVariant::fromValue<QObject*>(qobjectSingleton); Executed by:
executed 30 times by 2 tests: return QVariant::fromValue<QObject*>(qobjectSingleton); Executed by:
| 30 | ||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||
61 | return never executed: QVariant::fromValue<QJSValue>(siinfo->scriptApi(e));return QVariant::fromValue<QJSValue>(siinfo->scriptApi(e)); never executed: return QVariant::fromValue<QJSValue>(siinfo->scriptApi(e)); | 0 | ||||||||||||||||||||||||
62 | } | - | ||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | ReturnedValue QQmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, const QQmlType &t, | - | ||||||||||||||||||||||||
67 | Heap::QQmlTypeWrapper::TypeNameMode mode) | - | ||||||||||||||||||||||||
68 | { | - | ||||||||||||||||||||||||
69 | ((t.isValid()) ? static_cast<void>(0) : qt_assert("t.isValid()", __FILE__, 116)); | - | ||||||||||||||||||||||||
70 | Scope scope(engine); | - | ||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||
72 | Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>()); | - | ||||||||||||||||||||||||
73 | w->d()->mode = mode; w->d()->object = o; | - | ||||||||||||||||||||||||
74 | w->d()->typePrivate = t.priv(); | - | ||||||||||||||||||||||||
75 | QQmlType::refHandle(w->d()->typePrivate); | - | ||||||||||||||||||||||||
76 | return executed 149512 times by 42 tests: w.asReturnedValue();return w.asReturnedValue(); Executed by:
executed 149512 times by 42 tests: return w.asReturnedValue(); Executed by:
| 149512 | ||||||||||||||||||||||||
77 | } | - | ||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | ReturnedValue QQmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, const QQmlRefPointer<QQmlTypeNameCache> &t, const QQmlImportRef *importNamespace, | - | ||||||||||||||||||||||||
82 | Heap::QQmlTypeWrapper::TypeNameMode mode) | - | ||||||||||||||||||||||||
83 | { | - | ||||||||||||||||||||||||
84 | ((t) ? static_cast<void>(0) : qt_assert("t", __FILE__, 131)); | - | ||||||||||||||||||||||||
85 | ((importNamespace) ? static_cast<void>(0) : qt_assert("importNamespace", __FILE__, 132)); | - | ||||||||||||||||||||||||
86 | Scope scope(engine); | - | ||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | Scoped<QQmlTypeWrapper> w(scope, engine->memoryManager->allocate<QQmlTypeWrapper>()); | - | ||||||||||||||||||||||||
89 | w->d()->mode = mode; w->d()->object = o; w->d()->typeNamespace = t.data(); w->d()->importNamespace = importNamespace; | - | ||||||||||||||||||||||||
90 | t->addref(); | - | ||||||||||||||||||||||||
91 | return executed 324 times by 5 tests: w.asReturnedValue();return w.asReturnedValue(); Executed by:
executed 324 times by 5 tests: return w.asReturnedValue(); Executed by:
| 324 | ||||||||||||||||||||||||
92 | } | - | ||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||
94 | static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, QObject *qobjectSingleton, | - | ||||||||||||||||||||||||
95 | const QQmlType &type, bool *ok) | - | ||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||
97 | ((ok != nullptr) ? static_cast<void>(0) : qt_assert("ok != nullptr", __FILE__, 144)); | - | ||||||||||||||||||||||||
98 | int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, ok); | - | ||||||||||||||||||||||||
99 | if (*
| 4-12 | ||||||||||||||||||||||||
100 | return executed 12 times by 2 tests: value;return value; Executed by:
executed 12 times by 2 tests: return value; Executed by:
| 12 | ||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | QByteArray enumName = name->toQString().toUtf8(); | - | ||||||||||||||||||||||||
104 | const QMetaObject *metaObject = qobjectSingleton->metaObject(); | - | ||||||||||||||||||||||||
105 | for (int ii = metaObject->enumeratorCount() - 1; ii >= 0
| 4 | ||||||||||||||||||||||||
106 | QMetaEnum e = metaObject->enumerator(ii); | - | ||||||||||||||||||||||||
107 | value = e.keyToValue(enumName.constData(), ok); | - | ||||||||||||||||||||||||
108 | if (*
| 0-4 | ||||||||||||||||||||||||
109 | return never executed: value;return value; never executed: return value; | 0 | ||||||||||||||||||||||||
110 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
111 | *ok = false; | - | ||||||||||||||||||||||||
112 | return executed 4 times by 1 test: -1;return -1; Executed by:
executed 4 times by 1 test: return -1; Executed by:
| 4 | ||||||||||||||||||||||||
113 | } | - | ||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | static ReturnedValue throwLowercaseEnumError(QV4::ExecutionEngine *v4, String *name, const QQmlType &type) | - | ||||||||||||||||||||||||
116 | { | - | ||||||||||||||||||||||||
117 | const QString message = | - | ||||||||||||||||||||||||
118 | ([]() noexcept -> QString { enum { Size = sizeof(u"" "Cannot access enum value '%1' of '%2', enum values need to start with an uppercase letter.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Cannot access enum value '%1' of '%2', enum values need to start with an uppercase letter." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()) | - | ||||||||||||||||||||||||
119 | .arg(name->toQString()).arg(QLatin1String(type.typeName())); | - | ||||||||||||||||||||||||
120 | return never executed: v4->throwTypeError(message);return v4->throwTypeError(message); never executed: return v4->throwTypeError(message); | 0 | ||||||||||||||||||||||||
121 | } | - | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) | - | ||||||||||||||||||||||||
124 | { | - | ||||||||||||||||||||||||
125 | ((m->as<QQmlTypeWrapper>()) ? static_cast<void>(0) : qt_assert("m->as<QQmlTypeWrapper>()", __FILE__, 172)); | - | ||||||||||||||||||||||||
126 | - | |||||||||||||||||||||||||
127 | if (!id.isString()
| 56-148572 | ||||||||||||||||||||||||
128 | return executed 56 times by 1 test: Object::virtualGet(m, id, receiver, hasProperty);return Object::virtualGet(m, id, receiver, hasProperty); Executed by:
executed 56 times by 1 test: return Object::virtualGet(m, id, receiver, hasProperty); Executed by:
| 56 | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine(); | - | ||||||||||||||||||||||||
131 | QV4::Scope scope(v4); | - | ||||||||||||||||||||||||
132 | ScopedString name(scope, id.asStringOrSymbol()); | - | ||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m)); | - | ||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||
136 | if (hasProperty
| 6-148566 | ||||||||||||||||||||||||
137 | * executed 6 times by 1 test: hasProperty = true;*hasProperty = true; Executed by:
executed 6 times by 1 test: *hasProperty = true; Executed by:
| 6 | ||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||
139 | QQmlContextData *context = v4->callingQmlContext(); | - | ||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | QObject *object = w->d()->object; | - | ||||||||||||||||||||||||
142 | QQmlType type = w->d()->type(); | - | ||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | if (type.isValid()
| 324-148248 | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | if (type.isSingleton()
| 446-147802 | ||||||||||||||||||||||||
148 | QQmlEngine *e = v4->qmlEngine(); | - | ||||||||||||||||||||||||
149 | QQmlType::SingletonInstanceInfo *siinfo = type.singletonInstanceInfo(); | - | ||||||||||||||||||||||||
150 | siinfo->init(e); | - | ||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||
152 | QObject *qobjectSingleton = siinfo->qobjectApi(e); | - | ||||||||||||||||||||||||
153 | if (qobjectSingleton
| 28-418 | ||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | const bool includeEnums = w->d()->mode == Heap::QQmlTypeWrapper::IncludeEnums; | - | ||||||||||||||||||||||||
157 | if (includeEnums
| 0-418 | ||||||||||||||||||||||||
158 | bool ok = false; | - | ||||||||||||||||||||||||
159 | const int value = enumForSingleton(v4, name, qobjectSingleton, type, &ok); | - | ||||||||||||||||||||||||
160 | if (ok
| 0-12 | ||||||||||||||||||||||||
161 | return executed 12 times by 2 tests: QV4::Primitive::fromInt32(value).asReturnedValue();return QV4::Primitive::fromInt32(value).asReturnedValue(); Executed by:
executed 12 times by 2 tests: return QV4::Primitive::fromInt32(value).asReturnedValue(); Executed by:
| 12 | ||||||||||||||||||||||||
162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
163 | - | |||||||||||||||||||||||||
164 | - | |||||||||||||||||||||||||
165 | bool ok; | - | ||||||||||||||||||||||||
166 | const ReturnedValue result = QV4::QObjectWrapper::getQmlProperty(v4, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, &ok); | - | ||||||||||||||||||||||||
167 | if (hasProperty
| 2-404 | ||||||||||||||||||||||||
168 | * executed 2 times by 1 test: hasProperty = ok;*hasProperty = ok; Executed by:
executed 2 times by 1 test: *hasProperty = ok; Executed by:
| 2 | ||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | if (!ok
| 0-402 | ||||||||||||||||||||||||
172 | enumForSingleton(v4, name, qobjectSingleton, type, &ok); | - | ||||||||||||||||||||||||
173 | if (ok
| 0-4 | ||||||||||||||||||||||||
174 | return never executed: throwLowercaseEnumError(v4, name, type);return throwLowercaseEnumError(v4, name, type); never executed: return throwLowercaseEnumError(v4, name, type); | 0 | ||||||||||||||||||||||||
175 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||
177 | return executed 406 times by 12 tests: result;return result; Executed by:
executed 406 times by 12 tests: return result; Executed by:
| 406 | ||||||||||||||||||||||||
178 | } else if (!siinfo->scriptApi(e).isUndefined()
| 0-28 | ||||||||||||||||||||||||
179 | - | |||||||||||||||||||||||||
180 | QV4::ScopedObject o(scope, QJSValuePrivate::convertedToValue(v4, siinfo->scriptApi(e))); | - | ||||||||||||||||||||||||
181 | if (!!o
| 0-28 | ||||||||||||||||||||||||
182 | return executed 28 times by 1 test: o->get(name);return o->get(name); Executed by:
executed 28 times by 1 test: return o->get(name); Executed by:
| 28 | ||||||||||||||||||||||||
183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||
189 | if (name->startsWithUpper()
| 6166-141636 | ||||||||||||||||||||||||
190 | bool ok = false; | - | ||||||||||||||||||||||||
191 | int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok); | - | ||||||||||||||||||||||||
192 | if (ok
| 8-6158 | ||||||||||||||||||||||||
193 | return executed 6158 times by 26 tests: QV4::Primitive::fromInt32(value).asReturnedValue();return QV4::Primitive::fromInt32(value).asReturnedValue(); Executed by:
executed 6158 times by 26 tests: return QV4::Primitive::fromInt32(value).asReturnedValue(); Executed by:
| 6158 | ||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | value = type.scopedEnumIndex(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok); | - | ||||||||||||||||||||||||
196 | if (ok
| 0-8 | ||||||||||||||||||||||||
197 | Scoped<QQmlScopedEnumWrapper> enumWrapper(scope, v4->memoryManager->allocate<QQmlScopedEnumWrapper>()); | - | ||||||||||||||||||||||||
198 | enumWrapper->d()->typePrivate = type.priv(); | - | ||||||||||||||||||||||||
199 | QQmlType::refHandle(enumWrapper->d()->typePrivate); | - | ||||||||||||||||||||||||
200 | enumWrapper->d()->scopeEnumIndex = value; | - | ||||||||||||||||||||||||
201 | return never executed: enumWrapper.asReturnedValue();return enumWrapper.asReturnedValue(); never executed: return enumWrapper.asReturnedValue(); | 0 | ||||||||||||||||||||||||
202 | } | - | ||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | - | |||||||||||||||||||||||||
206 | } executed 8 times by 1 test: else if (w->d()->objectend of block Executed by:
| 2-141634 | ||||||||||||||||||||||||
207 | QObject *ao = qmlAttachedPropertiesObjectById(type.attachedPropertiesId(QQmlEnginePrivate::get(v4->qmlEngine())), object); | - | ||||||||||||||||||||||||
208 | if (ao
| 8-141626 | ||||||||||||||||||||||||
209 | return executed 141626 times by 19 tests: QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);return QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty); Executed by:
executed 141626 times by 19 tests: return QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty); Executed by:
| 141626 | ||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||
219 | } else if (w->d()->typeNamespace
| 0-324 | ||||||||||||||||||||||||
220 | ((w->d()->importNamespace) ? static_cast<void>(0) : qt_assert("w->d()->importNamespace", __FILE__, 267)); | - | ||||||||||||||||||||||||
221 | QQmlTypeNameCache::Result r = w->d()->typeNamespace->query(name, w->d()->importNamespace); | - | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | if (r.isValid()
| 2-322 | ||||||||||||||||||||||||
224 | if (r.type.isValid()
| 8-314 | ||||||||||||||||||||||||
225 | return executed 314 times by 5 tests: create(scope.engine, object, r.type, w->d()->mode);return create(scope.engine, object, r.type, w->d()->mode); Executed by:
executed 314 times by 5 tests: return create(scope.engine, object, r.type, w->d()->mode); Executed by:
| 314 | ||||||||||||||||||||||||
226 | } else if (r.scriptIndex != -1
| 0-8 | ||||||||||||||||||||||||
227 | QV4::ScopedObject scripts(scope, context->importedScripts.valueRef()); | - | ||||||||||||||||||||||||
228 | return executed 8 times by 1 test: scripts->get(r.scriptIndex);return scripts->get(r.scriptIndex); Executed by:
executed 8 times by 1 test: return scripts->get(r.scriptIndex); Executed by:
| 8 | ||||||||||||||||||||||||
229 | } else if (r.importNamespace
| 0 | ||||||||||||||||||||||||
230 | return never executed: create(scope.engine, object, context->imports, r.importNamespace);return create(scope.engine, object, context->imports, r.importNamespace); never executed: return create(scope.engine, object, context->imports, r.importNamespace); | 0 | ||||||||||||||||||||||||
231 | } | - | ||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | } | - | ||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||
239 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||
240 | ((!"Unreachable") ? static_cast<void>(0) : qt_assert("!\"Unreachable\"", __FILE__, 287)); | - | ||||||||||||||||||||||||
241 | } never executed: end of block | 0 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | bool ok = false; | - | ||||||||||||||||||||||||
244 | const ReturnedValue result = Object::virtualGet(m, id, receiver, &ok); | - | ||||||||||||||||||||||||
245 | if (hasProperty
| 2-18 | ||||||||||||||||||||||||
246 | * executed 2 times by 1 test: hasProperty = ok;*hasProperty = ok; Executed by:
executed 2 times by 1 test: *hasProperty = ok; Executed by:
| 2 | ||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||
249 | if (!ok
| 0-16 | ||||||||||||||||||||||||
250 | bool enumOk = false; | - | ||||||||||||||||||||||||
251 | type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &enumOk); | - | ||||||||||||||||||||||||
252 | if (enumOk
| 0-6 | ||||||||||||||||||||||||
253 | return never executed: throwLowercaseEnumError(v4, name, type);return throwLowercaseEnumError(v4, name, type); never executed: return throwLowercaseEnumError(v4, name, type); | 0 | ||||||||||||||||||||||||
254 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | return executed 20 times by 1 test: result;return result; Executed by:
executed 20 times by 1 test: return result; Executed by:
| 20 | ||||||||||||||||||||||||
257 | } | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | bool QQmlTypeWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) | - | ||||||||||||||||||||||||
261 | { | - | ||||||||||||||||||||||||
262 | if (!id.isString()
| 0-1184 | ||||||||||||||||||||||||
263 | return never executed: Object::virtualPut(m, id, value, receiver);return Object::virtualPut(m, id, value, receiver); never executed: return Object::virtualPut(m, id, value, receiver); | 0 | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | ((m->as<QQmlTypeWrapper>()) ? static_cast<void>(0) : qt_assert("m->as<QQmlTypeWrapper>()", __FILE__, 313)); | - | ||||||||||||||||||||||||
267 | QQmlTypeWrapper *w = static_cast<QQmlTypeWrapper *>(m); | - | ||||||||||||||||||||||||
268 | QV4::Scope scope(w); | - | ||||||||||||||||||||||||
269 | if (scope.engine->hasException
| 0-1184 | ||||||||||||||||||||||||
270 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||
272 | ScopedString name(scope, id.asStringOrSymbol()); | - | ||||||||||||||||||||||||
273 | QQmlContextData *context = scope.engine->callingQmlContext(); | - | ||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | QQmlType type = w->d()->type(); | - | ||||||||||||||||||||||||
276 | if (type.isValid()
| 0-1184 | ||||||||||||||||||||||||
277 | QObject *object = w->d()->object; | - | ||||||||||||||||||||||||
278 | QQmlEngine *e = scope.engine->qmlEngine(); | - | ||||||||||||||||||||||||
279 | QObject *ao = qmlAttachedPropertiesObjectById(type.attachedPropertiesId(QQmlEnginePrivate::get(e)), object); | - | ||||||||||||||||||||||||
280 | if (ao
| 0-1112 | ||||||||||||||||||||||||
281 | return executed 1112 times by 5 tests: QV4::QObjectWrapper::setQmlProperty(scope.engine, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value); Executed by:
executed 1112 times by 5 tests: return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value); Executed by:
| 1112 | ||||||||||||||||||||||||
282 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
283 | } else if (type.isSingleton()
| 0-72 | ||||||||||||||||||||||||
284 | QQmlEngine *e = scope.engine->qmlEngine(); | - | ||||||||||||||||||||||||
285 | QQmlType::SingletonInstanceInfo *siinfo = type.singletonInstanceInfo(); | - | ||||||||||||||||||||||||
286 | siinfo->init(e); | - | ||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | QObject *qobjectSingleton = siinfo->qobjectApi(e); | - | ||||||||||||||||||||||||
289 | if (qobjectSingleton
| 4-68 | ||||||||||||||||||||||||
290 | return executed 68 times by 6 tests: QV4::QObjectWrapper::setQmlProperty(scope.engine, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value); Executed by:
executed 68 times by 6 tests: return QV4::QObjectWrapper::setQmlProperty(scope.engine, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value); Executed by:
| 68 | ||||||||||||||||||||||||
291 | } else if (!siinfo->scriptApi(e).isUndefined()
| 0-4 | ||||||||||||||||||||||||
292 | QV4::ScopedObject apiprivate(scope, QJSValuePrivate::convertedToValue(scope.engine, siinfo->scriptApi(e))); | - | ||||||||||||||||||||||||
293 | if (!apiprivate
| 0-4 | ||||||||||||||||||||||||
294 | QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"'); | - | ||||||||||||||||||||||||
295 | scope.engine->throwError(error); | - | ||||||||||||||||||||||||
296 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
297 | } else { | - | ||||||||||||||||||||||||
298 | return executed 4 times by 1 test: apiprivate->put(name, value);return apiprivate->put(name, value); Executed by:
executed 4 times by 1 test: return apiprivate->put(name, value); Executed by:
| 4 | ||||||||||||||||||||||||
299 | } | - | ||||||||||||||||||||||||
300 | } | - | ||||||||||||||||||||||||
301 | } never executed: end of block | 0 | ||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
304 | } | - | ||||||||||||||||||||||||
305 | - | |||||||||||||||||||||||||
306 | PropertyAttributes QQmlTypeWrapper::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) | - | ||||||||||||||||||||||||
307 | { | - | ||||||||||||||||||||||||
308 | if (id.isString()
| 0-6 | ||||||||||||||||||||||||
309 | Scope scope(m); | - | ||||||||||||||||||||||||
310 | ScopedString n(scope, id.asStringOrSymbol()); | - | ||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||
312 | bool hasProperty = false; | - | ||||||||||||||||||||||||
313 | static_cast<Object *>(m)->get(n, &hasProperty); | - | ||||||||||||||||||||||||
314 | return executed 6 times by 1 test: hasProperty ? Attr_Data : Attr_Invalid;return hasProperty ? Attr_Data : Attr_Invalid; Executed by:
executed 6 times by 1 test: return hasProperty ? Attr_Data : Attr_Invalid; Executed by:
| 6 | ||||||||||||||||||||||||
315 | } | - | ||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | return never executed: QV4::Object::virtualGetOwnProperty(m, id, p);return QV4::Object::virtualGetOwnProperty(m, id, p); never executed: return QV4::Object::virtualGetOwnProperty(m, id, p); | 0 | ||||||||||||||||||||||||
318 | } | - | ||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||
320 | bool QQmlTypeWrapper::virtualIsEqualTo(Managed *a, Managed *b) | - | ||||||||||||||||||||||||
321 | { | - | ||||||||||||||||||||||||
322 | ((a->as<QV4::QQmlTypeWrapper>()) ? static_cast<void>(0) : qt_assert("a->as<QV4::QQmlTypeWrapper>()", __FILE__, 369)); | - | ||||||||||||||||||||||||
323 | QV4::QQmlTypeWrapper *qmlTypeWrapperA = static_cast<QV4::QQmlTypeWrapper *>(a); | - | ||||||||||||||||||||||||
324 | if (QV4::QQmlTypeWrapper *qmlTypeWrapperB = b->as<QV4::QQmlTypeWrapper>()
| 2-6 | ||||||||||||||||||||||||
325 | return executed 2 times by 1 test: qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant();return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant(); Executed by:
executed 2 times by 1 test: return qmlTypeWrapperA->toVariant() == qmlTypeWrapperB->toVariant(); Executed by:
| 2 | ||||||||||||||||||||||||
326 | else if (QV4::QObjectWrapper *qobjectWrapper = b->as<QV4::QObjectWrapper>()
| 0-6 | ||||||||||||||||||||||||
327 | return executed 6 times by 1 test: qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object();return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object(); Executed by:
executed 6 times by 1 test: return qmlTypeWrapperA->toVariant().value<QObject*>() == qobjectWrapper->object(); Executed by:
| 6 | ||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||
329 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
330 | } | - | ||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||
332 | ReturnedValue QQmlTypeWrapper::virtualInstanceOf(const Object *typeObject, const Value &var) | - | ||||||||||||||||||||||||
333 | { | - | ||||||||||||||||||||||||
334 | ((typeObject->as<QV4::QQmlTypeWrapper>()) ? static_cast<void>(0) : qt_assert("typeObject->as<QV4::QQmlTypeWrapper>()", __FILE__, 381)); | - | ||||||||||||||||||||||||
335 | const QV4::QQmlTypeWrapper *typeWrapper = static_cast<const QV4::QQmlTypeWrapper *>(typeObject); | - | ||||||||||||||||||||||||
336 | QV4::ExecutionEngine *engine = typeObject->internalClass()->engine; | - | ||||||||||||||||||||||||
337 | QQmlEnginePrivate *qenginepriv = QQmlEnginePrivate::get(engine->qmlEngine()); | - | ||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | const QObjectWrapper *wrapper = var.as<QObjectWrapper>(); | - | ||||||||||||||||||||||||
341 | if (!wrapper
| 0-56 | ||||||||||||||||||||||||
342 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||
345 | const QObject *wrapperObject = wrapper->object(); | - | ||||||||||||||||||||||||
346 | if (!wrapperObject
| 0-56 | ||||||||||||||||||||||||
347 | return never executed: engine->throwTypeError();return engine->throwTypeError(); never executed: return engine->throwTypeError(); | 0 | ||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||
349 | const int myTypeId = typeWrapper->d()->type().typeId(); | - | ||||||||||||||||||||||||
350 | QQmlMetaObject myQmlType; | - | ||||||||||||||||||||||||
351 | if (myTypeId == 0
| 0-56 | ||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||
353 | - | |||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | QQmlData *theirDData = QQmlData::get(wrapperObject, false); | - | ||||||||||||||||||||||||
356 | ((theirDData) ? static_cast<void>(0) : qt_assert("theirDData", __FILE__, 403)); | - | ||||||||||||||||||||||||
357 | if (!theirDData->compilationUnit
| 0 | ||||||||||||||||||||||||
358 | return never executed: Encode(false);return Encode(false); never executed: return Encode(false); | 0 | ||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | QQmlRefPointer<QQmlTypeData> td = qenginepriv->typeLoader.getType(typeWrapper->d()->type().sourceUrl()); | - | ||||||||||||||||||||||||
361 | CompiledData::CompilationUnit *cu = td->compilationUnit(); | - | ||||||||||||||||||||||||
362 | myQmlType = qenginepriv->metaObjectForType(cu->metaTypeId); | - | ||||||||||||||||||||||||
363 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
364 | myQmlType = qenginepriv->metaObjectForType(myTypeId); | - | ||||||||||||||||||||||||
365 | } executed 56 times by 1 test: end of block Executed by:
| 56 | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | const QMetaObject *theirType = wrapperObject->metaObject(); | - | ||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||
369 | return executed 56 times by 1 test: QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType));return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType)); Executed by:
executed 56 times by 1 test: return QV4::Encode(QQmlMetaObject::canConvert(theirType, myQmlType)); Executed by:
| 56 | ||||||||||||||||||||||||
370 | } | - | ||||||||||||||||||||||||
371 | - | |||||||||||||||||||||||||
372 | void Heap::QQmlScopedEnumWrapper::destroy() | - | ||||||||||||||||||||||||
373 | { | - | ||||||||||||||||||||||||
374 | QQmlType::derefHandle(typePrivate); | - | ||||||||||||||||||||||||
375 | typePrivate = nullptr; | - | ||||||||||||||||||||||||
376 | Object::destroy(); | - | ||||||||||||||||||||||||
377 | } never executed: end of block | 0 | ||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||
379 | QQmlType Heap::QQmlScopedEnumWrapper::type() const | - | ||||||||||||||||||||||||
380 | { | - | ||||||||||||||||||||||||
381 | return never executed: QQmlType(typePrivate);return QQmlType(typePrivate); never executed: return QQmlType(typePrivate); | 0 | ||||||||||||||||||||||||
382 | } | - | ||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) | - | ||||||||||||||||||||||||
385 | { | - | ||||||||||||||||||||||||
386 | ((m->as<QQmlScopedEnumWrapper>()) ? static_cast<void>(0) : qt_assert("m->as<QQmlScopedEnumWrapper>()", __FILE__, 433)); | - | ||||||||||||||||||||||||
387 | if (!id.isString()
| 0 | ||||||||||||||||||||||||
388 | return never executed: Object::virtualGet(m, id, receiver, hasProperty);return Object::virtualGet(m, id, receiver, hasProperty); never executed: return Object::virtualGet(m, id, receiver, hasProperty); | 0 | ||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||
390 | const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m); | - | ||||||||||||||||||||||||
391 | QV4::ExecutionEngine *v4 = resource->engine(); | - | ||||||||||||||||||||||||
392 | QV4::Scope scope(v4); | - | ||||||||||||||||||||||||
393 | ScopedString name(scope, id.asStringOrSymbol()); | - | ||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | QQmlType type = resource->d()->type(); | - | ||||||||||||||||||||||||
396 | int index = resource->d()->scopeEnumIndex; | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | bool ok = false; | - | ||||||||||||||||||||||||
399 | int value = type.scopedEnumValue(QQmlEnginePrivate::get(v4->qmlEngine()), index, name, &ok); | - | ||||||||||||||||||||||||
400 | if (hasProperty
| 0 | ||||||||||||||||||||||||
401 | * never executed: hasProperty = ok;*hasProperty = ok; never executed: *hasProperty = ok; | 0 | ||||||||||||||||||||||||
402 | if (ok
| 0 | ||||||||||||||||||||||||
403 | return never executed: QV4::Primitive::fromInt32(value).asReturnedValue();return QV4::Primitive::fromInt32(value).asReturnedValue(); never executed: return QV4::Primitive::fromInt32(value).asReturnedValue(); | 0 | ||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||||||||
406 | } | - | ||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |