| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmllistwrapper.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | using namespace QV4; | - | ||||||||||||
| 6 | - | |||||||||||||
| 7 | const QV4::VTable QmlListWrapper::static_vtbl = { (std::is_same<QmlListWrapper::SuperClass, Object>::value) ? nullptr : &QmlListWrapper::SuperClass::static_vtbl, (sizeof(QmlListWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(QmlListWrapper::Data) + (QmlListWrapper::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(QmlListWrapper::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), QmlListWrapper::IsExecutionContext, QmlListWrapper::IsString, QmlListWrapper::IsObject, QmlListWrapper::IsFunctionObject, QmlListWrapper::IsErrorObject, QmlListWrapper::IsArrayData, QmlListWrapper::IsStringOrSymbol, QmlListWrapper::MyType, { 0, 0, 0, 0 }, "QmlListWrapper", QmlListWrapper::virtualDestroy, QmlListWrapper::Data::markObjects, QmlListWrapper::virtualIsEqualTo, QmlListWrapper::virtualGet, QmlListWrapper::virtualPut, QmlListWrapper::virtualDeleteProperty, QmlListWrapper::virtualHasProperty, QmlListWrapper::virtualGetOwnProperty, QmlListWrapper::virtualDefineOwnProperty, QmlListWrapper::virtualIsExtensible, QmlListWrapper::virtualPreventExtensions, QmlListWrapper::virtualGetPrototypeOf, QmlListWrapper::virtualSetPrototypeOf, QmlListWrapper::virtualGetLength, QmlListWrapper::virtualAdvanceIterator, QmlListWrapper::virtualInstanceOf, QmlListWrapper::virtualCall, QmlListWrapper::virtualCallAsConstructor, }; | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | void Heap::QmlListWrapper::init() | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | Object::init(); | - | ||||||||||||
| 12 | object.init(); | - | ||||||||||||
| 13 | QV4::Scope scope(internalClass->engine); | - | ||||||||||||
| 14 | QV4::ScopedObject o(scope, this); | - | ||||||||||||
| 15 | o->setArrayType(Heap::ArrayData::Custom); | - | ||||||||||||
| 16 | } executed 15812 times by 22 tests: end of blockExecuted by:
| 15812 | ||||||||||||
| 17 | - | |||||||||||||
| 18 | void Heap::QmlListWrapper::destroy() | - | ||||||||||||
| 19 | { | - | ||||||||||||
| 20 | object.destroy(); | - | ||||||||||||
| 21 | Object::destroy(); | - | ||||||||||||
| 22 | } executed 15812 times by 22 tests: end of blockExecuted by:
| 15812 | ||||||||||||
| 23 | - | |||||||||||||
| 24 | ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, QObject *object, int propId, int propType) | - | ||||||||||||
| 25 | { | - | ||||||||||||
| 26 | if (!object
| 0-15802 | ||||||||||||
| 27 | return never executed: Encode::null();return Encode::null();never executed: return Encode::null(); | 0 | ||||||||||||
| 28 | - | |||||||||||||
| 29 | Scope scope(engine); | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | Scoped<QmlListWrapper> r(scope, engine->memoryManager->allocate<QmlListWrapper>()); | - | ||||||||||||
| 32 | r->d()->object = object; | - | ||||||||||||
| 33 | r->d()->propertyType = propType; | - | ||||||||||||
| 34 | void *args[] = { &r->d()->property(), nullptr }; | - | ||||||||||||
| 35 | QMetaObject::metacall(object, QMetaObject::ReadProperty, propId, args); | - | ||||||||||||
| 36 | return executed 15802 times by 22 tests: r.asReturnedValue();return r.asReturnedValue();Executed by:
executed 15802 times by 22 tests: return r.asReturnedValue();Executed by:
| 15802 | ||||||||||||
| 37 | } | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, int propType) | - | ||||||||||||
| 40 | { | - | ||||||||||||
| 41 | Scope scope(engine); | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | Scoped<QmlListWrapper> r(scope, engine->memoryManager->allocate<QmlListWrapper>()); | - | ||||||||||||
| 44 | r->d()->object = prop.object; | - | ||||||||||||
| 45 | r->d()->property() = prop; | - | ||||||||||||
| 46 | r->d()->propertyType = propType; | - | ||||||||||||
| 47 | return executed 10 times by 3 tests: r.asReturnedValue();return r.asReturnedValue();Executed by:
executed 10 times by 3 tests: return r.asReturnedValue();Executed by:
| 10 | ||||||||||||
| 48 | } | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | QVariant QmlListWrapper::toVariant() const | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | if (!d()->object
| 0-44 | ||||||||||||
| 53 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||
| 54 | - | |||||||||||||
| 55 | return executed 44 times by 7 tests: QVariant::fromValue(QQmlListReferencePrivate::init(d()->property(), d()->propertyType, engine()->qmlEngine()));return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property(), d()->propertyType, engine()->qmlEngine()));Executed by:
executed 44 times by 7 tests: return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property(), d()->propertyType, engine()->qmlEngine()));Executed by:
| 44 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | - | |||||||||||||
| 59 | ReturnedValue QmlListWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty) | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 | ((m->as<QmlListWrapper>()) ? static_cast<void>(0) : qt_assert("m->as<QmlListWrapper>()", __FILE__, 107)); | - | ||||||||||||
| 62 | const QmlListWrapper *w = static_cast<const QmlListWrapper *>(m); | - | ||||||||||||
| 63 | QV4::ExecutionEngine *v4 = w->engine(); | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | if (id.isArrayIndex()
| 65642-78574 | ||||||||||||
| 66 | uint index = id.asArrayIndex(); | - | ||||||||||||
| 67 | quint32 count = w->d()->property().count
| 0-65642 | ||||||||||||
| 68 | if (index < count
| 0-65630 | ||||||||||||
| 69 | if (hasProperty
| 0-65630 | ||||||||||||
| 70 | * never executed: hasProperty = true;*hasProperty = true;never executed: *hasProperty = true; | 0 | ||||||||||||
| 71 | return executed 65630 times by 13 tests: QV4::QObjectWrapper::wrap(v4, w->d()->property().at(&w->d()->property(), index));return QV4::QObjectWrapper::wrap(v4, w->d()->property().at(&w->d()->property(), index));Executed by:
executed 65630 times by 13 tests: return QV4::QObjectWrapper::wrap(v4, w->d()->property().at(&w->d()->property(), index));Executed by:
| 65630 | ||||||||||||
| 72 | } | - | ||||||||||||
| 73 | - | |||||||||||||
| 74 | if (hasProperty
| 0-12 | ||||||||||||
| 75 | * never executed: hasProperty = false;*hasProperty = false;never executed: *hasProperty = false; | 0 | ||||||||||||
| 76 | return executed 12 times by 2 tests: Primitive::undefinedValue().asReturnedValue();return Primitive::undefinedValue().asReturnedValue();Executed by:
executed 12 times by 2 tests: return Primitive::undefinedValue().asReturnedValue();Executed by:
| 12 | ||||||||||||
| 77 | } else if (id.isString()
| 0-78574 | ||||||||||||
| 78 | if (id == v4->id_length()->propertyKey()
| 0-78568 | ||||||||||||
| 79 | quint32 count = w->d()->property().count
| 0-78568 | ||||||||||||
| 80 | return executed 78568 times by 16 tests: Primitive::fromUInt32(count).asReturnedValue();return Primitive::fromUInt32(count).asReturnedValue();Executed by:
executed 78568 times by 16 tests: return Primitive::fromUInt32(count).asReturnedValue();Executed by:
| 78568 | ||||||||||||
| 81 | } | - | ||||||||||||
| 82 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | return executed 6 times by 2 tests: Object::virtualGet(m, id, receiver, hasProperty);return Object::virtualGet(m, id, receiver, hasProperty);Executed by:
executed 6 times by 2 tests: return Object::virtualGet(m, id, receiver, hasProperty);Executed by:
| 6 | ||||||||||||
| 85 | } | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | bool QmlListWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver) | - | ||||||||||||
| 88 | { | - | ||||||||||||
| 89 | - | |||||||||||||
| 90 | (void)m;; | - | ||||||||||||
| 91 | (void)id;; | - | ||||||||||||
| 92 | (void)value;; | - | ||||||||||||
| 93 | (void)receiver;; | - | ||||||||||||
| 94 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 95 | } | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | void QmlListWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) | - | ||||||||||||
| 98 | { | - | ||||||||||||
| 99 | name->setM(nullptr); | - | ||||||||||||
| 100 | *index = | - | ||||||||||||
| 101 | (0x7fffffff * 2U + 1U) | - | ||||||||||||
| 102 | ; | - | ||||||||||||
| 103 | ((m->as<QmlListWrapper>()) ? static_cast<void>(0) : qt_assert("m->as<QmlListWrapper>()", __FILE__, 147)); | - | ||||||||||||
| 104 | QmlListWrapper *w = static_cast<QmlListWrapper *>(m); | - | ||||||||||||
| 105 | quint32 count = w->d()->property().count
| 0-26 | ||||||||||||
| 106 | if (it->arrayIndex < count
| 4-22 | ||||||||||||
| 107 | *index = it->arrayIndex; | - | ||||||||||||
| 108 | ++it->arrayIndex; | - | ||||||||||||
| 109 | *attrs = QV4::Attr_Data; | - | ||||||||||||
| 110 | p->value = QV4::QObjectWrapper::wrap(w->engine(), w->d()->property().at(&w->d()->property(), *index)); | - | ||||||||||||
| 111 | return; executed 22 times by 2 tests: return;Executed by:
| 22 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | return executed 4 times by 2 tests: QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attrs);return QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attrs);Executed by:
executed 4 times by 2 tests: return QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attrs);Executed by:
| 4 | ||||||||||||
| 114 | } | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | void PropertyListPrototype::init(ExecutionEngine *) | - | ||||||||||||
| 117 | { | - | ||||||||||||
| 118 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "push")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "push" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98034 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98034 times by 153 tests: }()), method_push, 1);return qstring_literal_temp;Executed by:
| 98034 | ||||||||||||
| 119 | } executed 98435 times by 153 tests: end of blockExecuted by:
| 98435 | ||||||||||||
| 120 | - | |||||||||||||
| 121 | ReturnedValue PropertyListPrototype::method_push(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | Scope scope(b); | - | ||||||||||||
| 124 | ScopedObject instance(scope, thisObject->toObject(scope.engine)); | - | ||||||||||||
| 125 | if (!instance
| 0-2 | ||||||||||||
| 126 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined();never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||
| 127 | QmlListWrapper *w = instance->as<QmlListWrapper>(); | - | ||||||||||||
| 128 | if (!w
| 0-2 | ||||||||||||
| 129 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined();never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||
| 130 | if (!w->d()->property().append
| 0-2 | ||||||||||||
| 131 | return never executed: scope.engine->throwError(QString::fromUtf8("List doesn't define an Append function"));return scope.engine->throwError(QString::fromUtf8("List doesn't define an Append function"));never executed: return scope.engine->throwError(QString::fromUtf8("List doesn't define an Append function")); | 0 | ||||||||||||
| 132 | - | |||||||||||||
| 133 | QV4::ScopedObject so(scope); | - | ||||||||||||
| 134 | for (int i = 0, ei = argc; i < ei
| 2-4 | ||||||||||||
| 135 | { | - | ||||||||||||
| 136 | so = argv[i].toObject(scope.engine); | - | ||||||||||||
| 137 | if (QV4::QObjectWrapper *wrapper = so->as<QV4::QObjectWrapper>()
| 0-4 | ||||||||||||
| 138 | w->d()->property().append(&w->d()->property(), wrapper->object() ); executed 4 times by 1 test: w->d()->property().append(&w->d()->property(), wrapper->object() );Executed by:
| 4 | ||||||||||||
| 139 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 140 | return executed 2 times by 1 test: Encode::undefined();return Encode::undefined();Executed by:
executed 2 times by 1 test: return Encode::undefined();Executed by:
| 2 | ||||||||||||
| 141 | } | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | - | |||||||||||||
| Switch to Source code | Preprocessed file |