| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4stringiterator.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | using namespace QV4; | - | ||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | const QV4::VTable StringIteratorObject::static_vtbl = { (std::is_same<StringIteratorObject::SuperClass, Object>::value) ? nullptr : &StringIteratorObject::SuperClass::static_vtbl, (sizeof(StringIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(StringIteratorObject::Data) + (StringIteratorObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(StringIteratorObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), StringIteratorObject::IsExecutionContext, StringIteratorObject::IsString, StringIteratorObject::IsObject, StringIteratorObject::IsFunctionObject, StringIteratorObject::IsErrorObject, StringIteratorObject::IsArrayData, StringIteratorObject::IsStringOrSymbol, StringIteratorObject::MyType, { 0, 0, 0, 0 }, "StringIteratorObject", StringIteratorObject::virtualDestroy, StringIteratorObject::Data::markObjects, StringIteratorObject::virtualIsEqualTo, StringIteratorObject::virtualGet, StringIteratorObject::virtualPut, StringIteratorObject::virtualDeleteProperty, StringIteratorObject::virtualHasProperty, StringIteratorObject::virtualGetOwnProperty, StringIteratorObject::virtualDefineOwnProperty, StringIteratorObject::virtualIsExtensible, StringIteratorObject::virtualPreventExtensions, StringIteratorObject::virtualGetPrototypeOf, StringIteratorObject::virtualSetPrototypeOf, StringIteratorObject::virtualGetLength, StringIteratorObject::virtualAdvanceIterator, StringIteratorObject::virtualInstanceOf, StringIteratorObject::virtualCall, StringIteratorObject::virtualCallAsConstructor, }; | - | ||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | void StringIteratorPrototype::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 98176 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98176 times by 153 tests: }()), method_next, 0);return qstring_literal_temp;Executed by:
| 98176 | ||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | Scope scope(e); | - | ||||||||||||||||||
| 11 | ScopedString val(scope, e->newString(QLatin1String("String Iterator"))); | - | ||||||||||||||||||
| 12 | defineReadonlyConfigurableProperty(e->symbol_toStringTag(), val); | - | ||||||||||||||||||
| 13 | } executed 99061 times by 153 tests: end of blockExecuted by:
| 99061 | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | ReturnedValue StringIteratorPrototype::method_next(const FunctionObject *b, const Value *that, const Value *, int) | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | Scope scope(b); | - | ||||||||||||||||||
| 18 | const StringIteratorObject *thisObject = that->as<StringIteratorObject>(); | - | ||||||||||||||||||
| 19 | if (!thisObject
| 4-162 | ||||||||||||||||||
| 20 | return executed 4 times by 1 test: scope.engine->throwTypeError(QLatin1String("Not an String Iterator instance"));return scope.engine->throwTypeError(QLatin1String("Not an String Iterator instance"));Executed by:
executed 4 times by 1 test: return scope.engine->throwTypeError(QLatin1String("Not an String Iterator instance"));Executed by:
| 4 | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | ScopedString s(scope, thisObject->d()->iteratedString); | - | ||||||||||||||||||
| 23 | if (!s
| 8-154 | ||||||||||||||||||
| 24 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||||||||||||||
| 25 | return executed 8 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
executed 8 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
| 8 | ||||||||||||||||||
| 26 | } | - | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | quint32 index = thisObject->d()->nextIndex; | - | ||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | QString str = s->toQString(); | - | ||||||||||||||||||
| 31 | quint32 len = str.length(); | - | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | if (index >= len
| 38-116 | ||||||||||||||||||
| 34 | thisObject->d()->iteratedString.set(scope.engine, nullptr); | - | ||||||||||||||||||
| 35 | QV4::Value undefined = Primitive::undefinedValue(); | - | ||||||||||||||||||
| 36 | return executed 38 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, undefined, true);return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
executed 38 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, undefined, true);Executed by:
| 38 | ||||||||||||||||||
| 37 | } | - | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | QChar ch = str.at(index); | - | ||||||||||||||||||
| 40 | int num = 1; | - | ||||||||||||||||||
| 41 | if (ch.unicode() >= 0xd800
| 4-80 | ||||||||||||||||||
| 42 | ch = str.at(index + 1); | - | ||||||||||||||||||
| 43 | if (ch.unicode() >= 0xdc00
| 0-16 | ||||||||||||||||||
| 44 | num = 2; executed 16 times by 1 test: num = 2;Executed by:
| 16 | ||||||||||||||||||
| 45 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | thisObject->d()->nextIndex += num; | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | ScopedString resultString(scope, scope.engine->newString(s->toQString().mid(index, num))); | - | ||||||||||||||||||
| 50 | return executed 116 times by 1 test: IteratorPrototype::createIterResultObject(scope.engine, resultString, false);return IteratorPrototype::createIterResultObject(scope.engine, resultString, false);Executed by:
executed 116 times by 1 test: return IteratorPrototype::createIterResultObject(scope.engine, resultString, false);Executed by:
| 116 | ||||||||||||||||||
| 51 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |