Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4arrayiterator.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | using namespace QV4; | - | ||||||
3 | - | |||||||
4 | const QV4::VTable ArrayIteratorObject::static_vtbl = { (std::is_same<ArrayIteratorObject::SuperClass, Object>::value) ? nullptr : &ArrayIteratorObject::SuperClass::static_vtbl, (sizeof(ArrayIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(ArrayIteratorObject::Data) + (ArrayIteratorObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(ArrayIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), ArrayIteratorObject::IsExecutionContext, ArrayIteratorObject::IsString, ArrayIteratorObject::IsObject, ArrayIteratorObject::IsFunctionObject, ArrayIteratorObject::IsErrorObject, ArrayIteratorObject::IsArrayData, ArrayIteratorObject::IsStringOrSymbol, ArrayIteratorObject::MyType, { 0, 0, 0, 0 }, "ArrayIteratorObject", ArrayIteratorObject::virtualDestroy, ArrayIteratorObject::Data::markObjects, ArrayIteratorObject::virtualIsEqualTo, ArrayIteratorObject::virtualGet, ArrayIteratorObject::virtualPut, ArrayIteratorObject::virtualDeleteProperty, ArrayIteratorObject::virtualHasProperty, ArrayIteratorObject::virtualGetOwnProperty, ArrayIteratorObject::virtualDefineOwnProperty, ArrayIteratorObject::virtualIsExtensible, ArrayIteratorObject::virtualPreventExtensions, ArrayIteratorObject::virtualGetPrototypeOf, ArrayIteratorObject::virtualSetPrototypeOf, ArrayIteratorObject::virtualGetLength, ArrayIteratorObject::virtualAdvanceIterator, ArrayIteratorObject::virtualInstanceOf, ArrayIteratorObject::virtualCall, ArrayIteratorObject::virtualCallAsConstructor, }; | - | ||||||
5 | - | |||||||
6 | void ArrayIteratorPrototype::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 98252 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98252 times by 153 tests: }()), method_next, 0);return qstring_literal_temp; Executed by:
| 98252 | ||||||
9 | - | |||||||
10 | Scope scope(e); | - | ||||||
11 | ScopedString val(scope, e->newString(QLatin1String("Array Iterator"))); | - | ||||||
12 | defineReadonlyConfigurableProperty(e->symbol_toStringTag(), val); | - | ||||||
13 | } executed 99009 times by 153 tests: end of block Executed by:
| 99009 | ||||||
14 | - | |||||||
15 | ReturnedValue ArrayIteratorPrototype::method_next(const FunctionObject *b, const Value *that, const Value *, int) | - | ||||||
16 | { | - | ||||||
17 | Scope scope(b); | - | ||||||
18 | const ArrayIteratorObject *thisObject = that->as<ArrayIteratorObject>(); | - | ||||||
19 | if (!thisObject
| 4-22863 | ||||||
20 | return executed 4 times by 1 test: scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance"));return scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance")); Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(QLatin1String("Not an Array Iterator instance")); Executed by:
| 4 | ||||||
21 | - | |||||||
22 | ScopedObject a(scope, thisObject->d()->iteratedObject); | - | ||||||
23 | if (!a
| 1067-21799 | ||||||
24 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||
25 | return executed 1067 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); Executed by:
executed 1067 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); Executed by:
| 1067 | ||||||
26 | } | - | ||||||
27 | - | |||||||
28 | quint32 index = thisObject->d()->nextIndex; | - | ||||||
29 | IteratorKind itemKind = thisObject->d()->iterationKind; | - | ||||||
30 | - | |||||||
31 | Scoped<TypedArray> ta(scope, a->as<TypedArray>()); | - | ||||||
32 | quint32 len = a->getLength(); | - | ||||||
33 | - | |||||||
34 | if (index >= len
| 6738-15155 | ||||||
35 | thisObject->d()->iteratedObject.set(scope.engine, nullptr); | - | ||||||
36 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||
37 | return executed 6733 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); Executed by:
executed 6733 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true); Executed by:
| 6733 | ||||||
38 | } | - | ||||||
39 | - | |||||||
40 | thisObject->d()->nextIndex = index + 1; | - | ||||||
41 | if (itemKind == KeyIteratorKind
| 160-15005 | ||||||
42 | return executed 160 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false);return IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false); Executed by:
executed 160 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Primitive::fromInt32(index), false); Executed by:
| 160 | ||||||
43 | } | - | ||||||
44 | - | |||||||
45 | ReturnedValue elementValue = a->get(index); | - | ||||||
46 | do { if (scope.hasException()
executed 4 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 4 times by 1 test: } } while (false);return QV4::Encode::undefined(); Executed by:
| 4-14970 | ||||||
47 | - | |||||||
48 | if (itemKind == ValueIteratorKind
| 156-14843 | ||||||
49 | return executed 14853 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false);return IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false); Executed by:
executed 14853 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, Value::fromReturnedValue(elementValue), false); Executed by:
| 14853 | ||||||
50 | } else { | - | ||||||
51 | ((itemKind == KeyValueIteratorKind) ? static_cast<void>(0) : qt_assert("itemKind == KeyValueIteratorKind", __FILE__, 95)); | - | ||||||
52 | - | |||||||
53 | ScopedArrayObject resultArray(scope, scope.engine->newArrayObject()); | - | ||||||
54 | resultArray->arrayReserve(2); | - | ||||||
55 | resultArray->arrayPut(0, Primitive::fromInt32(index)); | - | ||||||
56 | resultArray->arrayPut(1, Value::fromReturnedValue(elementValue)); | - | ||||||
57 | resultArray->setArrayLengthUnchecked(2); | - | ||||||
58 | - | |||||||
59 | return executed 156 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, resultArray, false);return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false); Executed by:
executed 156 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, resultArray, false); Executed by:
| 156 | ||||||
60 | } | - | ||||||
61 | } | - | ||||||
Switch to Source code | Preprocessed file |