| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4mapiterator.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | using namespace QV4; | - | ||||||
| 3 | - | |||||||
| 4 | const QV4::VTable MapIteratorObject::static_vtbl = { (std::is_same<MapIteratorObject::SuperClass, Object>::value) ? nullptr : &MapIteratorObject::SuperClass::static_vtbl, (sizeof(MapIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(MapIteratorObject::Data) + (MapIteratorObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(MapIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), MapIteratorObject::IsExecutionContext, MapIteratorObject::IsString, MapIteratorObject::IsObject, MapIteratorObject::IsFunctionObject, MapIteratorObject::IsErrorObject, MapIteratorObject::IsArrayData, MapIteratorObject::IsStringOrSymbol, MapIteratorObject::MyType, { 0, 0, 0, 0 }, "MapIteratorObject", MapIteratorObject::virtualDestroy, MapIteratorObject::Data::markObjects, MapIteratorObject::virtualIsEqualTo, MapIteratorObject::virtualGet, MapIteratorObject::virtualPut, MapIteratorObject::virtualDeleteProperty, MapIteratorObject::virtualHasProperty, MapIteratorObject::virtualGetOwnProperty, MapIteratorObject::virtualDefineOwnProperty, MapIteratorObject::virtualIsExtensible, MapIteratorObject::virtualPreventExtensions, MapIteratorObject::virtualGetPrototypeOf, MapIteratorObject::virtualSetPrototypeOf, MapIteratorObject::virtualGetLength, MapIteratorObject::virtualAdvanceIterator, MapIteratorObject::virtualInstanceOf, MapIteratorObject::virtualCall, MapIteratorObject::virtualCallAsConstructor, }; | - | ||||||
| 5 | - | |||||||
| 6 | void MapIteratorPrototype::init(ExecutionEngine *e) | - | ||||||
| 7 | { | - | ||||||
| 8 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "next")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "next" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98211 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98211 times by 153 tests: }()), method_next, 0);return qstring_literal_temp;Executed by:
| 98211 | ||||||
| 9 | - | |||||||
| 10 | Scope scope(e); | - | ||||||
| 11 | ScopedString val(scope, e->newString(QLatin1String("Map Iterator"))); | - | ||||||
| 12 | defineReadonlyConfigurableProperty(e->symbol_toStringTag(), val); | - | ||||||
| 13 | } executed 99001 times by 153 tests: end of blockExecuted by:
| 99001 | ||||||
| 14 | - | |||||||
| 15 | ReturnedValue MapIteratorPrototype::method_next(const FunctionObject *b, const Value *that, const Value *, int) | - | ||||||
| 16 | { | - | ||||||
| 17 | Scope scope(b); | - | ||||||
| 18 | const MapIteratorObject *thisObject = that->as<MapIteratorObject>(); | - | ||||||
| 19 | if (!thisObject
| 128-208 | ||||||
| 20 | return executed 128 times by 1 test: scope.engine->throwTypeError(QLatin1String("Not a Map Iterator instance"));return scope.engine->throwTypeError(QLatin1String("Not a Map Iterator instance"));Executed by:
executed 128 times by 1 test: return scope.engine->throwTypeError(QLatin1String("Not a Map Iterator instance"));Executed by:
| 128 | ||||||
| 21 | - | |||||||
| 22 | Scoped<MapObject> s(scope, thisObject->d()->iteratedMap); | - | ||||||
| 23 | uint index = thisObject->d()->mapNextIndex; | - | ||||||
| 24 | IteratorKind itemKind = thisObject->d()->iterationKind; | - | ||||||
| 25 | - | |||||||
| 26 | if (!s
| 28-180 | ||||||
| 27 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||
| 28 | return executed 28 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
executed 28 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
| 28 | ||||||
| 29 | } | - | ||||||
| 30 | - | |||||||
| 31 | Value *arguments = scope.alloc(2); | - | ||||||
| 32 | - | |||||||
| 33 | while (index < s->d()->esTable->size()
| 80-100 | ||||||
| 34 | s->d()->esTable->iterate(index, &arguments[0], &arguments[1]); | - | ||||||
| 35 | thisObject->d()->mapNextIndex = index + 1; | - | ||||||
| 36 | - | |||||||
| 37 | ScopedValue result(scope); | - | ||||||
| 38 | - | |||||||
| 39 | if (itemKind == KeyIteratorKind
| 12-88 | ||||||
| 40 | result = arguments[0]; | - | ||||||
| 41 | } executed 12 times by 1 test: else if (itemKind == ValueIteratorKindend of blockExecuted by:
| 12-76 | ||||||
| 42 | result = arguments[1]; | - | ||||||
| 43 | } executed 12 times by 1 test: else {end of blockExecuted by:
| 12 | ||||||
| 44 | ((itemKind == KeyValueIteratorKind) ? static_cast<void>(0) : qt_assert("itemKind == KeyValueIteratorKind", __FILE__, 88)); | - | ||||||
| 45 | - | |||||||
| 46 | result = scope.engine->newArrayObject(); | - | ||||||
| 47 | - | |||||||
| 48 | Scoped<ArrayObject> resultArray(scope, result); | - | ||||||
| 49 | resultArray->arrayReserve(2); | - | ||||||
| 50 | resultArray->arrayPut(0, arguments[0]); | - | ||||||
| 51 | resultArray->arrayPut(1, arguments[1]); | - | ||||||
| 52 | resultArray->setArrayLengthUnchecked(2); | - | ||||||
| 53 | } executed 76 times by 1 test: end of blockExecuted by:
| 76 | ||||||
| 54 | - | |||||||
| 55 | return executed 100 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, result, false);return IteratorPrototype::createIterResultObject(scope.engine, result, false);Executed by:
executed 100 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, result, false);Executed by:
| 100 | ||||||
| 56 | } | - | ||||||
| 57 | - | |||||||
| 58 | thisObject->d()->iteratedMap.set(scope.engine, nullptr); | - | ||||||
| 59 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||
| 60 | return executed 80 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
executed 80 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
| 80 | ||||||
| 61 | } | - | ||||||
| Switch to Source code | Preprocessed file |