Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4stringobject.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | - | |||||||||||||||||||
15 | using namespace QV4; | - | ||||||||||||||||||
16 | - | |||||||||||||||||||
17 | const QV4::VTable StringObject::static_vtbl = { (std::is_same<StringObject::SuperClass, Object>::value) ? nullptr : &StringObject::SuperClass::static_vtbl, (sizeof(StringObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(StringObject::Data) + (StringObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(StringObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), StringObject::IsExecutionContext, StringObject::IsString, StringObject::IsObject, StringObject::IsFunctionObject, StringObject::IsErrorObject, StringObject::IsArrayData, StringObject::IsStringOrSymbol, StringObject::MyType, { 0, 0, 0, 0 }, "StringObject", StringObject::virtualDestroy, StringObject::Data::markObjects, StringObject::virtualIsEqualTo, StringObject::virtualGet, StringObject::virtualPut, StringObject::virtualDeleteProperty, StringObject::virtualHasProperty, StringObject::virtualGetOwnProperty, StringObject::virtualDefineOwnProperty, StringObject::virtualIsExtensible, StringObject::virtualPreventExtensions, StringObject::virtualGetPrototypeOf, StringObject::virtualSetPrototypeOf, StringObject::virtualGetLength, StringObject::virtualAdvanceIterator, StringObject::virtualInstanceOf, StringObject::virtualCall, StringObject::virtualCallAsConstructor, }; | - | ||||||||||||||||||
18 | - | |||||||||||||||||||
19 | void Heap::StringObject::init() | - | ||||||||||||||||||
20 | { | - | ||||||||||||||||||
21 | Object::init(); | - | ||||||||||||||||||
22 | ((vtable() == QV4::StringObject::staticVTable()) ? static_cast<void>(0) : qt_assert("vtable() == QV4::StringObject::staticVTable()", __FILE__, 75)); | - | ||||||||||||||||||
23 | string.set(internalClass->engine, internalClass->engine->id_empty()->d()); | - | ||||||||||||||||||
24 | setProperty(internalClass->engine, LengthPropertyIndex, Primitive::fromInt32(0)); | - | ||||||||||||||||||
25 | } never executed: end of block | 0 | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | void Heap::StringObject::init(const QV4::String *str) | - | ||||||||||||||||||
28 | { | - | ||||||||||||||||||
29 | Object::init(); | - | ||||||||||||||||||
30 | string.set(internalClass->engine, str->d()); | - | ||||||||||||||||||
31 | setProperty(internalClass->engine, LengthPropertyIndex, Primitive::fromInt32(length())); | - | ||||||||||||||||||
32 | } executed 48304 times by 14 tests: end of block Executed by:
| 48304 | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | Heap::String *Heap::StringObject::getIndex(uint index) const | - | ||||||||||||||||||
35 | { | - | ||||||||||||||||||
36 | QString str = string->toQString(); | - | ||||||||||||||||||
37 | if (index >= (uint)str.length()
| 28-1076 | ||||||||||||||||||
38 | return executed 28 times by 2 tests: nullptr;return nullptr; Executed by:
executed 28 times by 2 tests: return nullptr; Executed by:
| 28 | ||||||||||||||||||
39 | return executed 1076 times by 4 tests: internalClass->engine->newString(str.mid(index, 1));return internalClass->engine->newString(str.mid(index, 1)); Executed by:
executed 1076 times by 4 tests: return internalClass->engine->newString(str.mid(index, 1)); Executed by:
| 1076 | ||||||||||||||||||
40 | } | - | ||||||||||||||||||
41 | - | |||||||||||||||||||
42 | uint Heap::StringObject::length() const | - | ||||||||||||||||||
43 | { | - | ||||||||||||||||||
44 | return executed 48934 times by 14 tests: string->length();return string->length(); Executed by:
executed 48934 times by 14 tests: return string->length(); Executed by:
| 48934 | ||||||||||||||||||
45 | } | - | ||||||||||||||||||
46 | - | |||||||||||||||||||
47 | bool StringObject::virtualDeleteProperty(Managed *m, PropertyKey id) | - | ||||||||||||||||||
48 | { | - | ||||||||||||||||||
49 | ((m->as<StringObject>()) ? static_cast<void>(0) : qt_assert("m->as<StringObject>()", __FILE__, 102)); | - | ||||||||||||||||||
50 | if (id.isArrayIndex()
| 28-86 | ||||||||||||||||||
51 | StringObject *o = static_cast<StringObject *>(m); | - | ||||||||||||||||||
52 | uint index = id.asArrayIndex(); | - | ||||||||||||||||||
53 | if (index < static_cast<uint>(o->d()->string->toQString().length())
| 2-26 | ||||||||||||||||||
54 | return executed 26 times by 2 tests: false;return false; Executed by:
executed 26 times by 2 tests: return false; Executed by:
| 26 | ||||||||||||||||||
55 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
56 | return executed 88 times by 2 tests: Object::virtualDeleteProperty(m, id);return Object::virtualDeleteProperty(m, id); Executed by:
executed 88 times by 2 tests: return Object::virtualDeleteProperty(m, id); Executed by:
| 88 | ||||||||||||||||||
57 | } | - | ||||||||||||||||||
58 | - | |||||||||||||||||||
59 | void StringObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) | - | ||||||||||||||||||
60 | { | - | ||||||||||||||||||
61 | name->setM(nullptr); | - | ||||||||||||||||||
62 | StringObject *s = static_cast<StringObject *>(m); | - | ||||||||||||||||||
63 | uint slen = s->d()->string->toQString().length(); | - | ||||||||||||||||||
64 | if (it->arrayIndex <= slen
| 28-577 | ||||||||||||||||||
65 | while (it->arrayIndex < slen
| 256-322 | ||||||||||||||||||
66 | *index = it->arrayIndex; | - | ||||||||||||||||||
67 | ++it->arrayIndex; | - | ||||||||||||||||||
68 | Property pd; | - | ||||||||||||||||||
69 | PropertyAttributes a = s->getOwnProperty(PropertyKey::fromArrayIndex(*index), &pd); | - | ||||||||||||||||||
70 | if (!(it->flags & ObjectIterator::EnumerableOnly)
| 0-174 | ||||||||||||||||||
71 | *attrs = a; | - | ||||||||||||||||||
72 | p->copy(&pd, a); | - | ||||||||||||||||||
73 | return; executed 322 times by 4 tests: return; Executed by:
| 322 | ||||||||||||||||||
74 | } | - | ||||||||||||||||||
75 | } never executed: end of block | 0 | ||||||||||||||||||
76 | if (s->arrayData()
| 12-244 | ||||||||||||||||||
77 | it->arrayNode = s->sparseBegin(); | - | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | while (it->arrayNode
| 0-12 | ||||||||||||||||||
80 | it->arrayNode = it->arrayNode->nextNode(); never executed: it->arrayNode = it->arrayNode->nextNode(); | 0 | ||||||||||||||||||
81 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||
82 | } executed 256 times by 4 tests: end of block Executed by:
| 256 | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | return executed 284 times by 4 tests: Object::virtualAdvanceIterator(m, it, name, index, p, attrs);return Object::virtualAdvanceIterator(m, it, name, index, p, attrs); Executed by:
executed 284 times by 4 tests: return Object::virtualAdvanceIterator(m, it, name, index, p, attrs); Executed by:
| 284 | ||||||||||||||||||
85 | } | - | ||||||||||||||||||
86 | - | |||||||||||||||||||
87 | PropertyAttributes StringObject::virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p) | - | ||||||||||||||||||
88 | { | - | ||||||||||||||||||
89 | PropertyAttributes attributes = Object::virtualGetOwnProperty(m, id, p); | - | ||||||||||||||||||
90 | if (attributes != Attr_Invalid
| 510-1548 | ||||||||||||||||||
91 | return executed 510 times by 1 test: attributes;return attributes; Executed by:
executed 510 times by 1 test: return attributes; Executed by:
| 510 | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | Object *o = static_cast<Object *>(m); | - | ||||||||||||||||||
94 | if (id.isArrayIndex()
| 542-1006 | ||||||||||||||||||
95 | uint index = id.asArrayIndex(); | - | ||||||||||||||||||
96 | if (o->isStringObject()
| 0-542 | ||||||||||||||||||
97 | if (index >= static_cast<const StringObject *>(m)->length()
| 12-530 | ||||||||||||||||||
98 | return executed 12 times by 1 test: Attr_Invalid;return Attr_Invalid; Executed by:
executed 12 times by 1 test: return Attr_Invalid; Executed by:
| 12 | ||||||||||||||||||
99 | if (p
| 92-438 | ||||||||||||||||||
100 | p->value = static_cast<StringObject *>(o)->getIndex(index); executed 438 times by 4 tests: p->value = static_cast<StringObject *>(o)->getIndex(index); Executed by:
| 438 | ||||||||||||||||||
101 | return executed 530 times by 4 tests: Attr_NotConfigurable|Attr_NotWritable;return Attr_NotConfigurable|Attr_NotWritable; Executed by:
executed 530 times by 4 tests: return Attr_NotConfigurable|Attr_NotWritable; Executed by:
| 530 | ||||||||||||||||||
102 | } | - | ||||||||||||||||||
103 | } never executed: end of block | 0 | ||||||||||||||||||
104 | return executed 1006 times by 2 tests: Attr_Invalid;return Attr_Invalid; Executed by:
executed 1006 times by 2 tests: return Attr_Invalid; Executed by:
| 1006 | ||||||||||||||||||
105 | } | - | ||||||||||||||||||
106 | - | |||||||||||||||||||
107 | const QV4::VTable StringCtor::static_vtbl = { (std::is_same<StringCtor::SuperClass, Object>::value) ? nullptr : &StringCtor::SuperClass::static_vtbl, (sizeof(StringCtor::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(StringCtor::Data) + (StringCtor::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(StringCtor::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), StringCtor::IsExecutionContext, StringCtor::IsString, StringCtor::IsObject, StringCtor::IsFunctionObject, StringCtor::IsErrorObject, StringCtor::IsArrayData, StringCtor::IsStringOrSymbol, StringCtor::MyType, { 0, 0, 0, 0 }, "StringCtor", StringCtor::virtualDestroy, StringCtor::Data::markObjects, StringCtor::virtualIsEqualTo, StringCtor::virtualGet, StringCtor::virtualPut, StringCtor::virtualDeleteProperty, StringCtor::virtualHasProperty, StringCtor::virtualGetOwnProperty, StringCtor::virtualDefineOwnProperty, StringCtor::virtualIsExtensible, StringCtor::virtualPreventExtensions, StringCtor::virtualGetPrototypeOf, StringCtor::virtualSetPrototypeOf, StringCtor::virtualGetLength, StringCtor::virtualAdvanceIterator, StringCtor::virtualInstanceOf, StringCtor::virtualCall, StringCtor::virtualCallAsConstructor, }; | - | ||||||||||||||||||
108 | - | |||||||||||||||||||
109 | void Heap::StringCtor::init(QV4::ExecutionContext *scope) | - | ||||||||||||||||||
110 | { | - | ||||||||||||||||||
111 | Heap::FunctionObject::init(scope, ([]() noexcept -> QString { enum { Size = sizeof(u"" "String")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "String" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98740 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98740 times by 153 tests: }()));return qstring_literal_temp; Executed by:
| 98740 | ||||||||||||||||||
112 | } executed 99086 times by 153 tests: end of block Executed by:
| 99086 | ||||||||||||||||||
113 | - | |||||||||||||||||||
114 | ReturnedValue StringCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *) | - | ||||||||||||||||||
115 | { | - | ||||||||||||||||||
116 | ExecutionEngine *v4 = static_cast<const Object *>(f)->engine(); | - | ||||||||||||||||||
117 | Scope scope(v4); | - | ||||||||||||||||||
118 | ScopedString value(scope); | - | ||||||||||||||||||
119 | if (argc
| 256-3214 | ||||||||||||||||||
120 | value = argv[0].toString(v4); executed 3215 times by 5 tests: value = argv[0].toString(v4); Executed by:
| 3215 | ||||||||||||||||||
121 | else | - | ||||||||||||||||||
122 | value = v4->newString(); executed 256 times by 1 test: value = v4->newString(); Executed by:
| 256 | ||||||||||||||||||
123 | do { if (scope.hasException()
executed 11 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 11 times by 1 test: } } while (false);return QV4::Encode::undefined(); Executed by:
| 11-3468 | ||||||||||||||||||
124 | return executed 3467 times by 5 tests: Encode(v4->newStringObject(value));return Encode(v4->newStringObject(value)); Executed by:
executed 3467 times by 5 tests: return Encode(v4->newStringObject(value)); Executed by:
| 3467 | ||||||||||||||||||
125 | } | - | ||||||||||||||||||
126 | - | |||||||||||||||||||
127 | ReturnedValue StringCtor::virtualCall(const FunctionObject *m, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||
128 | { | - | ||||||||||||||||||
129 | ExecutionEngine *v4 = m->engine(); | - | ||||||||||||||||||
130 | if (!argc
| 4-616874 | ||||||||||||||||||
131 | return executed 4 times by 1 test: v4->newString()->asReturnedValue();return v4->newString()->asReturnedValue(); Executed by:
executed 4 times by 1 test: return v4->newString()->asReturnedValue(); Executed by:
| 4 | ||||||||||||||||||
132 | if (argv[0].isSymbol()
| 500-616418 | ||||||||||||||||||
133 | return executed 500 times by 1 test: v4->newString(argv[0].symbolValue()->descriptiveString())->asReturnedValue();return v4->newString(argv[0].symbolValue()->descriptiveString())->asReturnedValue(); Executed by:
executed 500 times by 1 test: return v4->newString(argv[0].symbolValue()->descriptiveString())->asReturnedValue(); Executed by:
| 500 | ||||||||||||||||||
134 | return executed 616377 times by 1 test: argv[0].toString(v4)->asReturnedValue();return argv[0].toString(v4)->asReturnedValue(); Executed by:
executed 616377 times by 1 test: return argv[0].toString(v4)->asReturnedValue(); Executed by:
| 616377 | ||||||||||||||||||
135 | } | - | ||||||||||||||||||
136 | - | |||||||||||||||||||
137 | ReturnedValue StringCtor::method_fromCharCode(const FunctionObject *b, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||
138 | { | - | ||||||||||||||||||
139 | QString str(argc, Qt::Uninitialized); | - | ||||||||||||||||||
140 | QChar *ch = str.data(); | - | ||||||||||||||||||
141 | for (int i = 0, ei = argc; i < ei
| 17044476-28032727 | ||||||||||||||||||
142 | *ch = QChar(argv[i].toUInt16()); | - | ||||||||||||||||||
143 | ++ch; | - | ||||||||||||||||||
144 | } executed 28025947 times by 2 tests: end of block Executed by:
| 28025947 | ||||||||||||||||||
145 | *ch = 0; | - | ||||||||||||||||||
146 | return executed 17068719 times by 2 tests: Encode(b->engine()->newString(str));return Encode(b->engine()->newString(str)); Executed by:
executed 17068719 times by 2 tests: return Encode(b->engine()->newString(str)); Executed by:
| 17068719 | ||||||||||||||||||
147 | } | - | ||||||||||||||||||
148 | - | |||||||||||||||||||
149 | - | |||||||||||||||||||
150 | - | |||||||||||||||||||
151 | ReturnedValue StringCtor::method_fromCodePoint(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||
152 | { | - | ||||||||||||||||||
153 | ExecutionEngine *e = f->engine(); | - | ||||||||||||||||||
154 | QString result(argc*2, Qt::Uninitialized); | - | ||||||||||||||||||
155 | QChar *ch = result.data(); | - | ||||||||||||||||||
156 | for (int i = 0; i < argc
| 59-140 | ||||||||||||||||||
157 | double num = argv[i].toNumber(); | - | ||||||||||||||||||
158 | if (e->hasException
| 16-124 | ||||||||||||||||||
159 | return executed 16 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 16 times by 1 test: return Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
160 | int cp = static_cast<int>(num); | - | ||||||||||||||||||
161 | if (cp != num
| 4-95 | ||||||||||||||||||
162 | return executed 40 times by 1 test: e->throwRangeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "String.fromCodePoint: argument out of range.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "String.fromCodePoint: argument out of range." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn e->throwRangeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "String.fromCodePoint: argument out of range.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "String.fromCodePoint: argument out of range." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
executed 40 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 40 times by 1 test: }()));return qstring_literal_temp; Executed by:
executed 40 times by 1 test: return e->throwRangeError(([]() noexcept -> QString { enum { Size = sizeof(u"" "String.fromCodePoint: argument out of range.")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "String.fromCodePoint: argument out of range." }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())); Executed by:
| 40 | ||||||||||||||||||
163 | if (cp > 0xffff
| 20-63 | ||||||||||||||||||
164 | *ch = QChar::highSurrogate(cp); | - | ||||||||||||||||||
165 | ++ch; | - | ||||||||||||||||||
166 | *ch = QChar::lowSurrogate(cp); | - | ||||||||||||||||||
167 | } executed 20 times by 1 test: else {end of block Executed by:
| 20 | ||||||||||||||||||
168 | *ch = cp; | - | ||||||||||||||||||
169 | } executed 63 times by 1 test: end of block Executed by:
| 63 | ||||||||||||||||||
170 | ++ch; | - | ||||||||||||||||||
171 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||
172 | *ch = 0; | - | ||||||||||||||||||
173 | result.truncate(ch - result.constData()); | - | ||||||||||||||||||
174 | return executed 60 times by 1 test: e->newString(result)->asReturnedValue();return e->newString(result)->asReturnedValue(); Executed by:
executed 60 times by 1 test: return e->newString(result)->asReturnedValue(); Executed by:
| 60 | ||||||||||||||||||
175 | } | - | ||||||||||||||||||
176 | - | |||||||||||||||||||
177 | void StringPrototype::init(ExecutionEngine *engine, Object *ctor) | - | ||||||||||||||||||
178 | { | - | ||||||||||||||||||
179 | Scope scope(engine); | - | ||||||||||||||||||
180 | ScopedObject o(scope); | - | ||||||||||||||||||
181 | - | |||||||||||||||||||
182 | - | |||||||||||||||||||
183 | Heap::InternalClass *ic = scope.engine->classes[ExecutionEngine::Class_StringObject]->changePrototype(scope.engine->objectPrototype()->d()); | - | ||||||||||||||||||
184 | d()->internalClass.set(scope.engine, ic); | - | ||||||||||||||||||
185 | d()->string.set(scope.engine, scope.engine->id_empty()->d()); | - | ||||||||||||||||||
186 | setProperty(scope.engine, Heap::StringObject::LengthPropertyIndex, Primitive::fromInt32(0)); | - | ||||||||||||||||||
187 | - | |||||||||||||||||||
188 | ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); | - | ||||||||||||||||||
189 | ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(1)); | - | ||||||||||||||||||
190 | ctor->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "fromCharCode")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "fromCharCode" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98391 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98391 times by 153 tests: }()), StringCtor::method_fromCharCode, 1);return qstring_literal_temp; Executed by:
| 98391 | ||||||||||||||||||
191 | ctor->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "fromCodePoint")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "fromCodePoint" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98846 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98846 times by 153 tests: }()), StringCtor::method_fromCodePoint, 1);return qstring_literal_temp; Executed by:
| 98846 | ||||||||||||||||||
192 | - | |||||||||||||||||||
193 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "constructor")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "constructor" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98866 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98866 times by 153 tests: }()), (o = ctor));return qstring_literal_temp; Executed by:
| 98866 | ||||||||||||||||||
194 | defineDefaultProperty(engine->id_toString(), method_toString); | - | ||||||||||||||||||
195 | defineDefaultProperty(engine->id_valueOf(), method_toString); | - | ||||||||||||||||||
196 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "charAt")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "charAt" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99063 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99063 times by 153 tests: }()), method_charAt, 1);return qstring_literal_temp; Executed by:
| 99063 | ||||||||||||||||||
197 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "charCodeAt")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "charCodeAt" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98363 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98363 times by 153 tests: }()), method_charCodeAt, 1);return qstring_literal_temp; Executed by:
| 98363 | ||||||||||||||||||
198 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "codePointAt")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "codePointAt" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99090 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99090 times by 153 tests: }()), method_codePointAt, 1);return qstring_literal_temp; Executed by:
| 99090 | ||||||||||||||||||
199 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "concat")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "concat" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98876 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98876 times by 153 tests: }()), method_concat, 1);return qstring_literal_temp; Executed by:
| 98876 | ||||||||||||||||||
200 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "endsWith")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "endsWith" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99076 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99076 times by 153 tests: }()), method_endsWith, 1);return qstring_literal_temp; Executed by:
| 99076 | ||||||||||||||||||
201 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "indexOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "indexOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99056 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99056 times by 153 tests: }()), method_indexOf, 1);return qstring_literal_temp; Executed by:
| 99056 | ||||||||||||||||||
202 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "includes")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "includes" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99079 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99079 times by 153 tests: }()), method_includes, 1);return qstring_literal_temp; Executed by:
| 99079 | ||||||||||||||||||
203 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "lastIndexOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "lastIndexOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98838 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98838 times by 153 tests: }()), method_lastIndexOf, 1);return qstring_literal_temp; Executed by:
| 98838 | ||||||||||||||||||
204 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "localeCompare")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "localeCompare" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99101 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99101 times by 153 tests: }()), method_localeCompare, 1);return qstring_literal_temp; Executed by:
| 99101 | ||||||||||||||||||
205 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "match")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "match" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98810 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98810 times by 153 tests: }()), method_match, 1);return qstring_literal_temp; Executed by:
| 98810 | ||||||||||||||||||
206 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "normalize")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "normalize" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99086 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99086 times by 153 tests: }()), method_normalize, 0);return qstring_literal_temp; Executed by:
| 99086 | ||||||||||||||||||
207 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "padEnd")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "padEnd" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98854 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98854 times by 153 tests: }()), method_padEnd, 1);return qstring_literal_temp; Executed by:
| 98854 | ||||||||||||||||||
208 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "padStart")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "padStart" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98945 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98945 times by 153 tests: }()), method_padStart, 1);return qstring_literal_temp; Executed by:
| 98945 | ||||||||||||||||||
209 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "repeat")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "repeat" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99080 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99080 times by 153 tests: }()), method_repeat, 1);return qstring_literal_temp; Executed by:
| 99080 | ||||||||||||||||||
210 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "replace")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "replace" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99113 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99113 times by 153 tests: }()), method_replace, 2);return qstring_literal_temp; Executed by:
| 99113 | ||||||||||||||||||
211 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "search")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "search" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98910 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98910 times by 153 tests: }()), method_search, 1);return qstring_literal_temp; Executed by:
| 98910 | ||||||||||||||||||
212 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "slice")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "slice" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99088 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99088 times by 153 tests: }()), method_slice, 2);return qstring_literal_temp; Executed by:
| 99088 | ||||||||||||||||||
213 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "split")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "split" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98825 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98825 times by 153 tests: }()), method_split, 2);return qstring_literal_temp; Executed by:
| 98825 | ||||||||||||||||||
214 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "startsWith")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "startsWith" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98899 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98899 times by 153 tests: }()), method_startsWith, 1);return qstring_literal_temp; Executed by:
| 98899 | ||||||||||||||||||
215 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "substr")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "substr" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98912 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98912 times by 153 tests: }()), method_substr, 2);return qstring_literal_temp; Executed by:
| 98912 | ||||||||||||||||||
216 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "substring")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "substring" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99119 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99119 times by 153 tests: }()), method_substring, 2);return qstring_literal_temp; Executed by:
| 99119 | ||||||||||||||||||
217 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "toLowerCase")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "toLowerCase" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99059 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99059 times by 153 tests: }()), method_toLowerCase);return qstring_literal_temp; Executed by:
| 99059 | ||||||||||||||||||
218 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "toLocaleLowerCase")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "toLocaleLowerCase" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99088 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99088 times by 153 tests: }()), method_toLocaleLowerCase);return qstring_literal_temp; Executed by:
| 99088 | ||||||||||||||||||
219 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "toUpperCase")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "toUpperCase" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98846 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98846 times by 153 tests: }()), method_toUpperCase);return qstring_literal_temp; Executed by:
| 98846 | ||||||||||||||||||
220 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "toLocaleUpperCase")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "toLocaleUpperCase" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99108 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99108 times by 153 tests: }()), method_toLocaleUpperCase);return qstring_literal_temp; Executed by:
| 99108 | ||||||||||||||||||
221 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "trim")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "trim" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98817 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98817 times by 153 tests: }()), method_trim);return qstring_literal_temp; Executed by:
| 98817 | ||||||||||||||||||
222 | defineDefaultProperty(engine->symbol_iterator(), method_iterator); | - | ||||||||||||||||||
223 | } executed 98662 times by 153 tests: end of block Executed by:
| 98662 | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | static Heap::String *thisAsString(ExecutionEngine *v4, const QV4::Value *thisObject) | - | ||||||||||||||||||
226 | { | - | ||||||||||||||||||
227 | if (String *s = thisObject->stringValue()
| 112-359 | ||||||||||||||||||
228 | return executed 359 times by 1 test: s->d();return s->d(); Executed by:
executed 359 times by 1 test: return s->d(); Executed by:
| 359 | ||||||||||||||||||
229 | if (const
| 48-64 | ||||||||||||||||||
230 | return executed 48 times by 1 test: thisString->d()->string;return thisString->d()->string; Executed by:
executed 48 times by 1 test: return thisString->d()->string; Executed by:
| 48 | ||||||||||||||||||
231 | return executed 64 times by 1 test: thisObject->toString(v4);return thisObject->toString(v4); Executed by:
executed 64 times by 1 test: return thisObject->toString(v4); Executed by:
| 64 | ||||||||||||||||||
232 | } | - | ||||||||||||||||||
233 | - | |||||||||||||||||||
234 | static QString getThisString(ExecutionEngine *v4, const QV4::Value *thisObject) | - | ||||||||||||||||||
235 | { | - | ||||||||||||||||||
236 | if (String *s = thisObject->stringValue()
| 3682-570539 | ||||||||||||||||||
237 | return executed 570589 times by 10 tests: s->toQString();return s->toQString(); Executed by:
executed 570589 times by 10 tests: return s->toQString(); Executed by:
| 570589 | ||||||||||||||||||
238 | if (const
| 837-2844 | ||||||||||||||||||
239 | return executed 2843 times by 1 test: thisString->d()->string->toQString();return thisString->d()->string->toQString(); Executed by:
executed 2843 times by 1 test: return thisString->d()->string->toQString(); Executed by:
| 2843 | ||||||||||||||||||
240 | if (thisObject->isUndefined()
| 80-760 | ||||||||||||||||||
241 | v4->throwTypeError(); | - | ||||||||||||||||||
242 | return executed 159 times by 1 test: QString();return QString(); Executed by:
executed 159 times by 1 test: return QString(); Executed by:
| 159 | ||||||||||||||||||
243 | } | - | ||||||||||||||||||
244 | return executed 680 times by 1 test: thisObject->toQString();return thisObject->toQString(); Executed by:
executed 680 times by 1 test: return thisObject->toQString(); Executed by:
| 680 | ||||||||||||||||||
245 | } | - | ||||||||||||||||||
246 | - | |||||||||||||||||||
247 | ReturnedValue StringPrototype::method_toString(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||||||||
248 | { | - | ||||||||||||||||||
249 | if (thisObject->isString()
| 66-2271 | ||||||||||||||||||
250 | return executed 66 times by 2 tests: thisObject->asReturnedValue();return thisObject->asReturnedValue(); Executed by:
executed 66 times by 2 tests: return thisObject->asReturnedValue(); Executed by:
| 66 | ||||||||||||||||||
251 | - | |||||||||||||||||||
252 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
253 | const StringObject *o = thisObject->as<StringObject>(); | - | ||||||||||||||||||
254 | if (!o
| 16-2256 | ||||||||||||||||||
255 | return executed 16 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 16 times by 1 test: return v4->throwTypeError(); Executed by:
| 16 | ||||||||||||||||||
256 | return executed 2255 times by 2 tests: o->d()->string->asReturnedValue();return o->d()->string->asReturnedValue(); Executed by:
executed 2255 times by 2 tests: return o->d()->string->asReturnedValue(); Executed by:
| 2255 | ||||||||||||||||||
257 | } | - | ||||||||||||||||||
258 | - | |||||||||||||||||||
259 | ReturnedValue StringPrototype::method_charAt(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
260 | { | - | ||||||||||||||||||
261 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
262 | const QString str = getThisString(v4, thisObject); | - | ||||||||||||||||||
263 | if (v4->hasException
| 12-316 | ||||||||||||||||||
264 | return executed 12 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 12 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 12 | ||||||||||||||||||
265 | - | |||||||||||||||||||
266 | int pos = 0; | - | ||||||||||||||||||
267 | if (argc > 0
| 4-312 | ||||||||||||||||||
268 | pos = (int) argv[0].toInteger(); executed 312 times by 1 test: pos = (int) argv[0].toInteger(); Executed by:
| 312 | ||||||||||||||||||
269 | - | |||||||||||||||||||
270 | QString result; | - | ||||||||||||||||||
271 | if (pos >= 0
| 12-304 | ||||||||||||||||||
272 | result += str.at(pos); executed 288 times by 1 test: result += str.at(pos); Executed by:
| 288 | ||||||||||||||||||
273 | - | |||||||||||||||||||
274 | return executed 316 times by 1 test: Encode(v4->newString(result));return Encode(v4->newString(result)); Executed by:
executed 316 times by 1 test: return Encode(v4->newString(result)); Executed by:
| 316 | ||||||||||||||||||
275 | } | - | ||||||||||||||||||
276 | - | |||||||||||||||||||
277 | ReturnedValue StringPrototype::method_charCodeAt(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
278 | { | - | ||||||||||||||||||
279 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
280 | const QString str = getThisString(v4, thisObject); | - | ||||||||||||||||||
281 | if (v4->hasException
| 12-306 | ||||||||||||||||||
282 | return executed 12 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 12 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 12 | ||||||||||||||||||
283 | - | |||||||||||||||||||
284 | int pos = 0; | - | ||||||||||||||||||
285 | if (argc > 0
| 4-302 | ||||||||||||||||||
286 | pos = (int) argv[0].toInteger(); executed 301 times by 2 tests: pos = (int) argv[0].toInteger(); Executed by:
| 301 | ||||||||||||||||||
287 | - | |||||||||||||||||||
288 | - | |||||||||||||||||||
289 | if (pos >= 0
| 4-302 | ||||||||||||||||||
290 | return executed 294 times by 2 tests: QV4::Encode(Encode(str.at(pos).unicode()));return QV4::Encode(Encode(str.at(pos).unicode())); Executed by:
executed 294 times by 2 tests: return QV4::Encode(Encode(str.at(pos).unicode())); Executed by:
| 294 | ||||||||||||||||||
291 | - | |||||||||||||||||||
292 | return executed 12 times by 1 test: Encode(qt_qnan());return Encode(qt_qnan()); Executed by:
executed 12 times by 1 test: return Encode(qt_qnan()); Executed by:
| 12 | ||||||||||||||||||
293 | } | - | ||||||||||||||||||
294 | - | |||||||||||||||||||
295 | ReturnedValue StringPrototype::method_codePointAt(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
296 | { | - | ||||||||||||||||||
297 | ExecutionEngine *v4 = f->engine(); | - | ||||||||||||||||||
298 | QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
299 | if (v4->hasException
| 16-192 | ||||||||||||||||||
300 | return executed 16 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 16 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
301 | - | |||||||||||||||||||
302 | int index = argc
| 0-192 | ||||||||||||||||||
303 | if (v4->hasException
| 8-184 | ||||||||||||||||||
304 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
305 | - | |||||||||||||||||||
306 | if (index < 0
| 8-172 | ||||||||||||||||||
307 | return executed 20 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 20 times by 1 test: return Encode::undefined(); Executed by:
| 20 | ||||||||||||||||||
308 | - | |||||||||||||||||||
309 | uint first = value.at(index).unicode(); | - | ||||||||||||||||||
310 | if (QChar::isHighSurrogate(first)
| 12-124 | ||||||||||||||||||
311 | uint second = value.at(index + 1).unicode(); | - | ||||||||||||||||||
312 | if (QChar::isLowSurrogate(second)
| 48-64 | ||||||||||||||||||
313 | return executed 64 times by 1 test: Encode(QChar::surrogateToUcs4(first, second));return Encode(QChar::surrogateToUcs4(first, second)); Executed by:
executed 64 times by 1 test: return Encode(QChar::surrogateToUcs4(first, second)); Executed by:
| 64 | ||||||||||||||||||
314 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||
315 | return executed 100 times by 1 test: Encode(first);return Encode(first); Executed by:
executed 100 times by 1 test: return Encode(first); Executed by:
| 100 | ||||||||||||||||||
316 | } | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | ReturnedValue StringPrototype::method_concat(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
319 | { | - | ||||||||||||||||||
320 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
321 | QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
322 | if (v4->hasException
| 12-52 | ||||||||||||||||||
323 | return executed 12 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 12 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 12 | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | Scope scope(v4); | - | ||||||||||||||||||
326 | ScopedString s(scope); | - | ||||||||||||||||||
327 | for (int i = 0; i < argc
| 52-584 | ||||||||||||||||||
328 | s = argv[i].toString(scope.engine); | - | ||||||||||||||||||
329 | if (v4->hasException
| 0-584 | ||||||||||||||||||
330 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||||||||
331 | - | |||||||||||||||||||
332 | ((s->isString()) ? static_cast<void>(0) : qt_assert("s->isString()", __FILE__, 385)); | - | ||||||||||||||||||
333 | value += s->toQString(); | - | ||||||||||||||||||
334 | } executed 584 times by 1 test: end of block Executed by:
| 584 | ||||||||||||||||||
335 | - | |||||||||||||||||||
336 | return executed 52 times by 1 test: Encode(v4->newString(value));return Encode(v4->newString(value)); Executed by:
executed 52 times by 1 test: return Encode(v4->newString(value)); Executed by:
| 52 | ||||||||||||||||||
337 | } | - | ||||||||||||||||||
338 | - | |||||||||||||||||||
339 | ReturnedValue StringPrototype::method_endsWith(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
340 | { | - | ||||||||||||||||||
341 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
342 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
343 | if (v4->hasException
| 16-160 | ||||||||||||||||||
344 | return executed 16 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 16 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
345 | - | |||||||||||||||||||
346 | if (argc
| 0-154 | ||||||||||||||||||
347 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
348 | QString searchString = (argc
| 0-144 | ||||||||||||||||||
349 | if (v4->hasException
| 8-142 | ||||||||||||||||||
350 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
351 | - | |||||||||||||||||||
352 | int pos = value.length(); | - | ||||||||||||||||||
353 | if (argc > 1
| 43-99 | ||||||||||||||||||
354 | pos = (int) argv[1].toInteger(); executed 99 times by 1 test: pos = (int) argv[1].toInteger(); Executed by:
| 99 | ||||||||||||||||||
355 | - | |||||||||||||||||||
356 | if (pos == value.length()
| 64-80 | ||||||||||||||||||
357 | return executed 63 times by 1 test: QV4::Encode(Encode(value.endsWith(searchString)));return QV4::Encode(Encode(value.endsWith(searchString))); Executed by:
executed 63 times by 1 test: return QV4::Encode(Encode(value.endsWith(searchString))); Executed by:
| 63 | ||||||||||||||||||
358 | - | |||||||||||||||||||
359 | QStringRef stringToSearch = value.leftRef(pos); | - | ||||||||||||||||||
360 | return executed 80 times by 1 test: Encode(stringToSearch.endsWith(searchString));return Encode(stringToSearch.endsWith(searchString)); Executed by:
executed 80 times by 1 test: return Encode(stringToSearch.endsWith(searchString)); Executed by:
| 80 | ||||||||||||||||||
361 | } | - | ||||||||||||||||||
362 | - | |||||||||||||||||||
363 | ReturnedValue StringPrototype::method_indexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
364 | { | - | ||||||||||||||||||
365 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
366 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
367 | if (v4->hasException
| 8-15013 | ||||||||||||||||||
368 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
369 | - | |||||||||||||||||||
370 | QString searchString = (argc
| 4-15008 | ||||||||||||||||||
371 | if (v4->hasException
| 28-14985 | ||||||||||||||||||
372 | return executed 28 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 28 times by 1 test: return Encode::undefined(); Executed by:
| 28 | ||||||||||||||||||
373 | - | |||||||||||||||||||
374 | int pos = 0; | - | ||||||||||||||||||
375 | if (argc > 1
| 2472-12511 | ||||||||||||||||||
376 | pos = (int) argv[1].toInteger(); executed 2472 times by 1 test: pos = (int) argv[1].toInteger(); Executed by:
| 2472 | ||||||||||||||||||
377 | - | |||||||||||||||||||
378 | int index = -1; | - | ||||||||||||||||||
379 | if (! value.isEmpty()
| 32-14953 | ||||||||||||||||||
380 | index = value.indexOf(searchString, qMin(qMax(pos, 0), value.length())); executed 14944 times by 7 tests: index = value.indexOf(searchString, qMin(qMax(pos, 0), value.length())); Executed by:
| 14944 | ||||||||||||||||||
381 | - | |||||||||||||||||||
382 | return executed 14977 times by 7 tests: Encode(index);return Encode(index); Executed by:
executed 14977 times by 7 tests: return Encode(index); Executed by:
| 14977 | ||||||||||||||||||
383 | } | - | ||||||||||||||||||
384 | - | |||||||||||||||||||
385 | ReturnedValue StringPrototype::method_includes(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
386 | { | - | ||||||||||||||||||
387 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
388 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
389 | if (v4->hasException
| 15-160 | ||||||||||||||||||
390 | return executed 15 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 15 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 15 | ||||||||||||||||||
391 | - | |||||||||||||||||||
392 | if (argc
| 0-159 | ||||||||||||||||||
393 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
394 | QString searchString = (argc
| 0-151 | ||||||||||||||||||
395 | if (v4->hasException
| 8-144 | ||||||||||||||||||
396 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
397 | - | |||||||||||||||||||
398 | int pos = 0; | - | ||||||||||||||||||
399 | if (argc > 1
| 32-112 | ||||||||||||||||||
400 | const Value &posArg = argv[1]; | - | ||||||||||||||||||
401 | pos = (int) posArg.toInteger(); | - | ||||||||||||||||||
402 | if (!posArg.isInteger()
| 8-56 | ||||||||||||||||||
403 | pos = value.length(); executed 8 times by 1 test: pos = value.length(); Executed by:
| 8 | ||||||||||||||||||
404 | } executed 112 times by 1 test: end of block Executed by:
| 112 | ||||||||||||||||||
405 | - | |||||||||||||||||||
406 | if (pos == 0
| 64-80 | ||||||||||||||||||
407 | return executed 80 times by 1 test: QV4::Encode(Encode(value.contains(searchString)));return QV4::Encode(Encode(value.contains(searchString))); Executed by:
executed 80 times by 1 test: return QV4::Encode(Encode(value.contains(searchString))); Executed by:
| 80 | ||||||||||||||||||
408 | - | |||||||||||||||||||
409 | QStringRef stringToSearch = value.midRef(pos); | - | ||||||||||||||||||
410 | return executed 64 times by 1 test: Encode(stringToSearch.contains(searchString));return Encode(stringToSearch.contains(searchString)); Executed by:
executed 64 times by 1 test: return Encode(stringToSearch.contains(searchString)); Executed by:
| 64 | ||||||||||||||||||
411 | } | - | ||||||||||||||||||
412 | - | |||||||||||||||||||
413 | ReturnedValue StringPrototype::method_lastIndexOf(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
414 | { | - | ||||||||||||||||||
415 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
416 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
417 | if (v4->hasException
| 8-238 | ||||||||||||||||||
418 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
419 | - | |||||||||||||||||||
420 | QString searchString = (argc
| 4-234 | ||||||||||||||||||
421 | if (v4->hasException
| 8-230 | ||||||||||||||||||
422 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
423 | - | |||||||||||||||||||
424 | double position = argc > 1
| 24-206 | ||||||||||||||||||
425 | if (std::isnan(position)
| 8-222 | ||||||||||||||||||
426 | position = +qInf(); executed 8 times by 1 test: position = +qInf(); Executed by:
| 8 | ||||||||||||||||||
427 | else | - | ||||||||||||||||||
428 | position = trunc(position); executed 222 times by 4 tests: position = trunc(position); Executed by:
| 222 | ||||||||||||||||||
429 | - | |||||||||||||||||||
430 | int pos = trunc(qMin(qMax(position, 0.0), double(value.length()))); | - | ||||||||||||||||||
431 | if (!searchString.isEmpty()
| 0-230 | ||||||||||||||||||
432 | -- executed 214 times by 4 tests: pos;--pos; Executed by:
executed 214 times by 4 tests: --pos; Executed by:
| 214 | ||||||||||||||||||
433 | if (searchString.isNull()
| 0-230 | ||||||||||||||||||
434 | return never executed: QV4::Encode(Encode(-1));return QV4::Encode(Encode(-1)); never executed: return QV4::Encode(Encode(-1)); | 0 | ||||||||||||||||||
435 | int index = value.lastIndexOf(searchString, pos); | - | ||||||||||||||||||
436 | return executed 229 times by 4 tests: Encode(index);return Encode(index); Executed by:
executed 229 times by 4 tests: return Encode(index); Executed by:
| 229 | ||||||||||||||||||
437 | } | - | ||||||||||||||||||
438 | - | |||||||||||||||||||
439 | ReturnedValue StringPrototype::method_localeCompare(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
440 | { | - | ||||||||||||||||||
441 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
442 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
443 | if (v4->hasException
| 8-252 | ||||||||||||||||||
444 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
445 | - | |||||||||||||||||||
446 | const QString that = (argc
| 32-220 | ||||||||||||||||||
447 | return executed 252 times by 1 test: Encode(QString::localeAwareCompare(value, that));return Encode(QString::localeAwareCompare(value, that)); Executed by:
executed 252 times by 1 test: return Encode(QString::localeAwareCompare(value, that)); Executed by:
| 252 | ||||||||||||||||||
448 | } | - | ||||||||||||||||||
449 | - | |||||||||||||||||||
450 | ReturnedValue StringPrototype::method_match(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
451 | { | - | ||||||||||||||||||
452 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
453 | if (thisObject->isNullOrUndefined()
| 8-415 | ||||||||||||||||||
454 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
455 | - | |||||||||||||||||||
456 | Scope scope(v4); | - | ||||||||||||||||||
457 | ScopedString s(scope, thisObject->toString(v4)); | - | ||||||||||||||||||
458 | if (v4->hasException
| 0-414 | ||||||||||||||||||
459 | return never executed: Encode::undefined();return Encode::undefined(); never executed: return Encode::undefined(); | 0 | ||||||||||||||||||
460 | - | |||||||||||||||||||
461 | Scoped<RegExpObject> that(scope, argc ? argv[0] : Primitive::undefinedValue()); | - | ||||||||||||||||||
462 | if (!that
| 84-330 | ||||||||||||||||||
463 | - | |||||||||||||||||||
464 | that = RegExpCtor::virtualCallAsConstructor(b, argv, argc, b); | - | ||||||||||||||||||
465 | if (v4->hasException
| 8-76 | ||||||||||||||||||
466 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
467 | } executed 76 times by 1 test: end of block Executed by:
| 76 | ||||||||||||||||||
468 | ((!!that) ? static_cast<void>(0) : qt_assert("!!that", __FILE__, 521)); | - | ||||||||||||||||||
469 | - | |||||||||||||||||||
470 | bool global = that->global(); | - | ||||||||||||||||||
471 | - | |||||||||||||||||||
472 | if (!global
| 142-264 | ||||||||||||||||||
473 | return executed 264 times by 2 tests: RegExpPrototype::method_exec(b, that, s, 1);return RegExpPrototype::method_exec(b, that, s, 1); Executed by:
executed 264 times by 2 tests: return RegExpPrototype::method_exec(b, that, s, 1); Executed by:
| 264 | ||||||||||||||||||
474 | - | |||||||||||||||||||
475 | - | |||||||||||||||||||
476 | that->setLastIndex(0); | - | ||||||||||||||||||
477 | ScopedArrayObject a(scope, scope.engine->newArrayObject()); | - | ||||||||||||||||||
478 | - | |||||||||||||||||||
479 | int previousLastIndex = 0; | - | ||||||||||||||||||
480 | uint n = 0; | - | ||||||||||||||||||
481 | while (1) { | - | ||||||||||||||||||
482 | Value result = Primitive::fromReturnedValue(RegExpPrototype::execFirstMatch(b, that, s, 1)); | - | ||||||||||||||||||
483 | if (result.isNull()
| 144-680 | ||||||||||||||||||
484 | break; executed 144 times by 1 test: break; Executed by:
| 144 | ||||||||||||||||||
485 | int index = that->lastIndex(); | - | ||||||||||||||||||
486 | if (previousLastIndex == index
| 0-678 | ||||||||||||||||||
487 | previousLastIndex = index + 1; | - | ||||||||||||||||||
488 | that->setLastIndex(previousLastIndex); | - | ||||||||||||||||||
489 | } never executed: else {end of block | 0 | ||||||||||||||||||
490 | previousLastIndex = index; | - | ||||||||||||||||||
491 | } executed 678 times by 1 test: end of block Executed by:
| 678 | ||||||||||||||||||
492 | a->arraySet(n, result); | - | ||||||||||||||||||
493 | ++n; | - | ||||||||||||||||||
494 | } executed 678 times by 1 test: end of block Executed by:
| 678 | ||||||||||||||||||
495 | if (!n
| 0-144 | ||||||||||||||||||
496 | return never executed: Encode::null();return Encode::null(); never executed: return Encode::null(); | 0 | ||||||||||||||||||
497 | else | - | ||||||||||||||||||
498 | return executed 144 times by 1 test: a.asReturnedValue();return a.asReturnedValue(); Executed by:
executed 144 times by 1 test: return a.asReturnedValue(); Executed by:
| 144 | ||||||||||||||||||
499 | } | - | ||||||||||||||||||
500 | - | |||||||||||||||||||
501 | ReturnedValue StringPrototype::method_normalize(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
502 | { | - | ||||||||||||||||||
503 | ExecutionEngine *v4 = f->engine(); | - | ||||||||||||||||||
504 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
505 | if (v4->hasException
| 16-76 | ||||||||||||||||||
506 | return executed 16 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 16 times by 1 test: return Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
507 | - | |||||||||||||||||||
508 | QString::NormalizationForm form = QString::NormalizationForm_C; | - | ||||||||||||||||||
509 | if (argc >= 1
| 4-72 | ||||||||||||||||||
510 | QString f = argv[0].toQString(); | - | ||||||||||||||||||
511 | if (v4->hasException
| 8-60 | ||||||||||||||||||
512 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
513 | if (f == QLatin1String("NFC")
| 16-44 | ||||||||||||||||||
514 | form = QString::NormalizationForm_C; executed 16 times by 1 test: form = QString::NormalizationForm_C; Executed by:
| 16 | ||||||||||||||||||
515 | else if (f == QLatin1String("NFD")
| 16-28 | ||||||||||||||||||
516 | form = QString::NormalizationForm_D; executed 16 times by 1 test: form = QString::NormalizationForm_D; Executed by:
| 16 | ||||||||||||||||||
517 | else if (f == QLatin1String("NFKC")
| 8-20 | ||||||||||||||||||
518 | form = QString::NormalizationForm_KC; executed 8 times by 1 test: form = QString::NormalizationForm_KC; Executed by:
| 8 | ||||||||||||||||||
519 | else if (f == QLatin1String("NFKD")
| 8-12 | ||||||||||||||||||
520 | form = QString::NormalizationForm_KD; executed 8 times by 1 test: form = QString::NormalizationForm_KD; Executed by:
| 8 | ||||||||||||||||||
521 | else | - | ||||||||||||||||||
522 | return executed 12 times by 1 test: v4->throwRangeError(QLatin1String("String.prototype.normalize: Invalid normalization form."));return v4->throwRangeError(QLatin1String("String.prototype.normalize: Invalid normalization form.")); Executed by:
executed 12 times by 1 test: return v4->throwRangeError(QLatin1String("String.prototype.normalize: Invalid normalization form.")); Executed by:
| 12 | ||||||||||||||||||
523 | } | - | ||||||||||||||||||
524 | QString normalized = value.normalized(form); | - | ||||||||||||||||||
525 | return executed 56 times by 1 test: v4->newString(normalized)->asReturnedValue();return v4->newString(normalized)->asReturnedValue(); Executed by:
executed 56 times by 1 test: return v4->newString(normalized)->asReturnedValue(); Executed by:
| 56 | ||||||||||||||||||
526 | } | - | ||||||||||||||||||
527 | - | |||||||||||||||||||
528 | ReturnedValue StringPrototype::method_padEnd(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
529 | { | - | ||||||||||||||||||
530 | ExecutionEngine *v4 = f->engine(); | - | ||||||||||||||||||
531 | if (thisObject->isNullOrUndefined()
| 8-96 | ||||||||||||||||||
532 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
533 | - | |||||||||||||||||||
534 | Scope scope(v4); | - | ||||||||||||||||||
535 | ScopedString s(scope, thisAsString(v4, thisObject)); | - | ||||||||||||||||||
536 | if (v4->hasException
| 8-88 | ||||||||||||||||||
537 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
538 | if (!argc
| 0-88 | ||||||||||||||||||
539 | return never executed: s->asReturnedValue();return s->asReturnedValue(); never executed: return s->asReturnedValue(); | 0 | ||||||||||||||||||
540 | - | |||||||||||||||||||
541 | int maxLen = argv[0].toInteger(); | - | ||||||||||||||||||
542 | if (maxLen <= s->d()->length()
| 32-56 | ||||||||||||||||||
543 | return executed 32 times by 1 test: s->asReturnedValue();return s->asReturnedValue(); Executed by:
executed 32 times by 1 test: return s->asReturnedValue(); Executed by:
| 32 | ||||||||||||||||||
544 | QString fillString = (argc > 1
| 4-52 | ||||||||||||||||||
545 | if (v4->hasException
| 4-52 | ||||||||||||||||||
546 | return executed 4 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 4 times by 1 test: return Encode::undefined(); Executed by:
| 4 | ||||||||||||||||||
547 | - | |||||||||||||||||||
548 | if (fillString.isEmpty()
| 4-48 | ||||||||||||||||||
549 | return executed 4 times by 1 test: s->asReturnedValue();return s->asReturnedValue(); Executed by:
executed 4 times by 1 test: return s->asReturnedValue(); Executed by:
| 4 | ||||||||||||||||||
550 | - | |||||||||||||||||||
551 | QString padded = s->toQString(); | - | ||||||||||||||||||
552 | int oldLength = padded.length(); | - | ||||||||||||||||||
553 | int toFill = maxLen - oldLength; | - | ||||||||||||||||||
554 | padded.resize(maxLen); | - | ||||||||||||||||||
555 | QChar *ch = padded.data() + oldLength; | - | ||||||||||||||||||
556 | while (toFill
| 48-144 | ||||||||||||||||||
557 | int copy = qMin(fillString.length(), toFill); | - | ||||||||||||||||||
558 | memcpy(ch, fillString.constData(), copy*sizeof(QChar)); | - | ||||||||||||||||||
559 | toFill -= copy; | - | ||||||||||||||||||
560 | ch += copy; | - | ||||||||||||||||||
561 | } executed 144 times by 1 test: end of block Executed by:
| 144 | ||||||||||||||||||
562 | *ch = 0; | - | ||||||||||||||||||
563 | - | |||||||||||||||||||
564 | return executed 48 times by 1 test: v4->newString(padded)->asReturnedValue();return v4->newString(padded)->asReturnedValue(); Executed by:
executed 48 times by 1 test: return v4->newString(padded)->asReturnedValue(); Executed by:
| 48 | ||||||||||||||||||
565 | } | - | ||||||||||||||||||
566 | - | |||||||||||||||||||
567 | ReturnedValue StringPrototype::method_padStart(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
568 | { | - | ||||||||||||||||||
569 | ExecutionEngine *v4 = f->engine(); | - | ||||||||||||||||||
570 | if (thisObject->isNullOrUndefined()
| 8-95 | ||||||||||||||||||
571 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
572 | - | |||||||||||||||||||
573 | Scope scope(v4); | - | ||||||||||||||||||
574 | ScopedString s(scope, thisAsString(v4, thisObject)); | - | ||||||||||||||||||
575 | if (v4->hasException
| 8-88 | ||||||||||||||||||
576 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
577 | if (!argc
| 0-88 | ||||||||||||||||||
578 | return never executed: s->asReturnedValue();return s->asReturnedValue(); never executed: return s->asReturnedValue(); | 0 | ||||||||||||||||||
579 | - | |||||||||||||||||||
580 | int maxLen = argv[0].toInteger(); | - | ||||||||||||||||||
581 | if (maxLen <= s->d()->length()
| 32-56 | ||||||||||||||||||
582 | return executed 32 times by 1 test: s->asReturnedValue();return s->asReturnedValue(); Executed by:
executed 32 times by 1 test: return s->asReturnedValue(); Executed by:
| 32 | ||||||||||||||||||
583 | QString fillString = (argc > 1
| 4-52 | ||||||||||||||||||
584 | if (v4->hasException
| 4-52 | ||||||||||||||||||
585 | return executed 4 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 4 times by 1 test: return Encode::undefined(); Executed by:
| 4 | ||||||||||||||||||
586 | - | |||||||||||||||||||
587 | if (fillString.isEmpty()
| 4-48 | ||||||||||||||||||
588 | return executed 4 times by 1 test: s->asReturnedValue();return s->asReturnedValue(); Executed by:
executed 4 times by 1 test: return s->asReturnedValue(); Executed by:
| 4 | ||||||||||||||||||
589 | - | |||||||||||||||||||
590 | QString original = s->toQString(); | - | ||||||||||||||||||
591 | int oldLength = original.length(); | - | ||||||||||||||||||
592 | int toFill = maxLen - oldLength; | - | ||||||||||||||||||
593 | QString padded; | - | ||||||||||||||||||
594 | padded.resize(maxLen); | - | ||||||||||||||||||
595 | QChar *ch = padded.data(); | - | ||||||||||||||||||
596 | while (toFill
| 48-144 | ||||||||||||||||||
597 | int copy = qMin(fillString.length(), toFill); | - | ||||||||||||||||||
598 | memcpy(ch, fillString.constData(), copy*sizeof(QChar)); | - | ||||||||||||||||||
599 | toFill -= copy; | - | ||||||||||||||||||
600 | ch += copy; | - | ||||||||||||||||||
601 | } executed 144 times by 1 test: end of block Executed by:
| 144 | ||||||||||||||||||
602 | memcpy(ch, original.constData(), oldLength*sizeof(QChar)); | - | ||||||||||||||||||
603 | ch += oldLength; | - | ||||||||||||||||||
604 | *ch = 0; | - | ||||||||||||||||||
605 | - | |||||||||||||||||||
606 | return executed 48 times by 1 test: v4->newString(padded)->asReturnedValue();return v4->newString(padded)->asReturnedValue(); Executed by:
executed 48 times by 1 test: return v4->newString(padded)->asReturnedValue(); Executed by:
| 48 | ||||||||||||||||||
607 | } | - | ||||||||||||||||||
608 | - | |||||||||||||||||||
609 | - | |||||||||||||||||||
610 | ReturnedValue StringPrototype::method_repeat(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
611 | { | - | ||||||||||||||||||
612 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
613 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
614 | if (v4->hasException
| 16-72 | ||||||||||||||||||
615 | return executed 16 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 16 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
616 | - | |||||||||||||||||||
617 | double repeats = (argc
| 0-71 | ||||||||||||||||||
618 | - | |||||||||||||||||||
619 | if (repeats < 0
| 4-64 | ||||||||||||||||||
620 | return executed 12 times by 1 test: v4->throwRangeError(QLatin1String("Invalid count value"));return v4->throwRangeError(QLatin1String("Invalid count value")); Executed by:
executed 12 times by 1 test: return v4->throwRangeError(QLatin1String("Invalid count value")); Executed by:
| 12 | ||||||||||||||||||
621 | - | |||||||||||||||||||
622 | return executed 60 times by 1 test: Encode(v4->newString(value.repeated(int(repeats))));return Encode(v4->newString(value.repeated(int(repeats)))); Executed by:
executed 60 times by 1 test: return Encode(v4->newString(value.repeated(int(repeats)))); Executed by:
| 60 | ||||||||||||||||||
623 | } | - | ||||||||||||||||||
624 | - | |||||||||||||||||||
625 | static void appendReplacementString(QString *result, const QString &input, const QString& replaceValue, uint* matchOffsets, int captureCount) | - | ||||||||||||||||||
626 | { | - | ||||||||||||||||||
627 | result->reserve(result->length() + replaceValue.length()); | - | ||||||||||||||||||
628 | for (int i = 0; i < replaceValue.length()
| 603-780 | ||||||||||||||||||
629 | if (replaceValue.at(i) == QLatin1Char('$')
| 0-532 | ||||||||||||||||||
630 | ushort ch = replaceValue.at(++i).unicode(); | - | ||||||||||||||||||
631 | uint substStart = JSC::Yarr::offsetNoMatch; | - | ||||||||||||||||||
632 | uint substEnd = JSC::Yarr::offsetNoMatch; | - | ||||||||||||||||||
633 | if (ch == '$'
| 12-60 | ||||||||||||||||||
634 | *result += QChar(ch); | - | ||||||||||||||||||
635 | continue; executed 12 times by 1 test: continue; Executed by:
| 12 | ||||||||||||||||||
636 | } else if (ch == '&'
| 12-48 | ||||||||||||||||||
637 | substStart = matchOffsets[0]; | - | ||||||||||||||||||
638 | substEnd = matchOffsets[1]; | - | ||||||||||||||||||
639 | } executed 12 times by 1 test: else if (ch == '`'end of block Executed by:
| 12-36 | ||||||||||||||||||
640 | substStart = 0; | - | ||||||||||||||||||
641 | substEnd = matchOffsets[0]; | - | ||||||||||||||||||
642 | } executed 12 times by 1 test: else if (ch == '\''end of block Executed by:
| 12-24 | ||||||||||||||||||
643 | substStart = matchOffsets[1]; | - | ||||||||||||||||||
644 | substEnd = input.length(); | - | ||||||||||||||||||
645 | } executed 12 times by 1 test: else if (ch >= '1'end of block Executed by:
| 0-24 | ||||||||||||||||||
646 | uint capture = ch - '0'; | - | ||||||||||||||||||
647 | ((capture > 0) ? static_cast<void>(0) : qt_assert("capture > 0", __FILE__, 700)); | - | ||||||||||||||||||
648 | if (capture < static_cast<uint>(captureCount)
| 0-24 | ||||||||||||||||||
649 | substStart = matchOffsets[capture * 2]; | - | ||||||||||||||||||
650 | substEnd = matchOffsets[capture * 2 + 1]; | - | ||||||||||||||||||
651 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||
652 | } executed 24 times by 1 test: else if (ch == '0'end of block Executed by:
| 0-24 | ||||||||||||||||||
653 | int capture = (ch - '0') * 10; | - | ||||||||||||||||||
654 | ch = replaceValue.at(++i).unicode(); | - | ||||||||||||||||||
655 | if (ch >= '0'
| 0 | ||||||||||||||||||
656 | capture += ch - '0'; | - | ||||||||||||||||||
657 | if (capture > 0
| 0 | ||||||||||||||||||
658 | substStart = matchOffsets[capture * 2]; | - | ||||||||||||||||||
659 | substEnd = matchOffsets[capture * 2 + 1]; | - | ||||||||||||||||||
660 | } never executed: end of block | 0 | ||||||||||||||||||
661 | } never executed: end of block | 0 | ||||||||||||||||||
662 | } never executed: end of block | 0 | ||||||||||||||||||
663 | if (substStart != JSC::Yarr::offsetNoMatch
| 0-60 | ||||||||||||||||||
664 | * executed 60 times by 1 test: result += input.midRef(substStart, substEnd - substStart);*result += input.midRef(substStart, substEnd - substStart); Executed by:
executed 60 times by 1 test: *result += input.midRef(substStart, substEnd - substStart); Executed by:
| 60 | ||||||||||||||||||
665 | } executed 59 times by 1 test: else {end of block Executed by:
| 59 | ||||||||||||||||||
666 | *result += replaceValue.at(i); | - | ||||||||||||||||||
667 | } executed 532 times by 1 test: end of block Executed by:
| 532 | ||||||||||||||||||
668 | } | - | ||||||||||||||||||
669 | } executed 780 times by 1 test: end of block Executed by:
| 780 | ||||||||||||||||||
670 | - | |||||||||||||||||||
671 | ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
672 | { | - | ||||||||||||||||||
673 | QString string; | - | ||||||||||||||||||
674 | if (const
| 12-2267 | ||||||||||||||||||
675 | string = thisString->d()->string->toQString(); executed 12 times by 1 test: string = thisString->d()->string->toQString(); Executed by:
| 12 | ||||||||||||||||||
676 | else | - | ||||||||||||||||||
677 | string = thisObject->toQString(); executed 2267 times by 3 tests: string = thisObject->toQString(); Executed by:
| 2267 | ||||||||||||||||||
678 | - | |||||||||||||||||||
679 | int numCaptures = 0; | - | ||||||||||||||||||
680 | int numStringMatches = 0; | - | ||||||||||||||||||
681 | - | |||||||||||||||||||
682 | uint allocatedMatchOffsets = 64; | - | ||||||||||||||||||
683 | uint _matchOffsets[64]; | - | ||||||||||||||||||
684 | uint *matchOffsets = _matchOffsets; | - | ||||||||||||||||||
685 | - | |||||||||||||||||||
686 | Scope scope(b); | - | ||||||||||||||||||
687 | ScopedValue searchValue(scope, argc ? argv[0] : Primitive::undefinedValue()); | - | ||||||||||||||||||
688 | Scoped<RegExpObject> regExp(scope, searchValue); | - | ||||||||||||||||||
689 | if (regExp
| 80-2199 | ||||||||||||||||||
690 | uint offset = 0; | - | ||||||||||||||||||
691 | uint nMatchOffsets = 0; | - | ||||||||||||||||||
692 | - | |||||||||||||||||||
693 | - | |||||||||||||||||||
694 | Scoped<RegExp> re(scope, regExp->value()); | - | ||||||||||||||||||
695 | while (true) { | - | ||||||||||||||||||
696 | int oldSize = nMatchOffsets; | - | ||||||||||||||||||
697 | if (allocatedMatchOffsets < nMatchOffsets + re->captureCount() * 2
| 0-2937 | ||||||||||||||||||
698 | allocatedMatchOffsets = qMax(allocatedMatchOffsets * 2, nMatchOffsets + re->captureCount() * 2); | - | ||||||||||||||||||
699 | uint *newOffsets = (uint *)malloc(allocatedMatchOffsets*sizeof(uint)); | - | ||||||||||||||||||
700 | memcpy(newOffsets, matchOffsets, nMatchOffsets*sizeof(uint)); | - | ||||||||||||||||||
701 | if (matchOffsets != _matchOffsets
| 0 | ||||||||||||||||||
702 | free(matchOffsets); never executed: free(matchOffsets); | 0 | ||||||||||||||||||
703 | matchOffsets = newOffsets; | - | ||||||||||||||||||
704 | } never executed: end of block | 0 | ||||||||||||||||||
705 | if (re->match(string, offset, matchOffsets + oldSize) == JSC::Yarr::offsetNoMatch
| 794-2144 | ||||||||||||||||||
706 | nMatchOffsets = oldSize; | - | ||||||||||||||||||
707 | break; executed 2144 times by 3 tests: break; Executed by:
| 2144 | ||||||||||||||||||
708 | } | - | ||||||||||||||||||
709 | nMatchOffsets += re->captureCount() * 2; | - | ||||||||||||||||||
710 | if (!regExp->global()
| 56-738 | ||||||||||||||||||
711 | break; executed 56 times by 1 test: break; Executed by:
| 56 | ||||||||||||||||||
712 | offset = qMax(offset + 1, matchOffsets[oldSize + 1]); | - | ||||||||||||||||||
713 | } executed 738 times by 2 tests: end of block Executed by:
| 738 | ||||||||||||||||||
714 | if (regExp->global()
| 55-2144 | ||||||||||||||||||
715 | regExp->setLastIndex(0); executed 2144 times by 3 tests: regExp->setLastIndex(0); Executed by:
| 2144 | ||||||||||||||||||
716 | numStringMatches = nMatchOffsets / (regExp->value()->captureCount() * 2); | - | ||||||||||||||||||
717 | numCaptures = regExp->value()->captureCount(); | - | ||||||||||||||||||
718 | } executed 2200 times by 3 tests: else {end of block Executed by:
| 2200 | ||||||||||||||||||
719 | numCaptures = 1; | - | ||||||||||||||||||
720 | QString searchString = searchValue->toQString(); | - | ||||||||||||||||||
721 | int idx = string.indexOf(searchString); | - | ||||||||||||||||||
722 | if (idx != -1
| 20-60 | ||||||||||||||||||
723 | numStringMatches = 1; | - | ||||||||||||||||||
724 | matchOffsets[0] = idx; | - | ||||||||||||||||||
725 | matchOffsets[1] = idx + searchString.length(); | - | ||||||||||||||||||
726 | } executed 60 times by 1 test: end of block Executed by:
| 60 | ||||||||||||||||||
727 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||||||||
728 | - | |||||||||||||||||||
729 | QString result; | - | ||||||||||||||||||
730 | ScopedValue replacement(scope); | - | ||||||||||||||||||
731 | ScopedValue replaceValue(scope, argc > 1 ? argv[1] : Primitive::undefinedValue()); | - | ||||||||||||||||||
732 | ScopedFunctionObject searchCallback(scope, replaceValue); | - | ||||||||||||||||||
733 | if (!!searchCallback
| 64-2216 | ||||||||||||||||||
734 | result.reserve(string.length() + 10*numStringMatches); | - | ||||||||||||||||||
735 | ScopedValue entry(scope); | - | ||||||||||||||||||
736 | Value *arguments = scope.alloc(numCaptures + 2); | - | ||||||||||||||||||
737 | int lastEnd = 0; | - | ||||||||||||||||||
738 | for (int i = 0; i < numStringMatches
| 64-74 | ||||||||||||||||||
739 | for (int k = 0; k < numCaptures
| 74-128 | ||||||||||||||||||
740 | int idx = (i * numCaptures + k) * 2; | - | ||||||||||||||||||
741 | uint start = matchOffsets[idx]; | - | ||||||||||||||||||
742 | uint end = matchOffsets[idx + 1]; | - | ||||||||||||||||||
743 | entry = Primitive::undefinedValue(); | - | ||||||||||||||||||
744 | if (start != JSC::Yarr::offsetNoMatch
| 0-128 | ||||||||||||||||||
745 | entry = scope.engine->newString(string.mid(start, end - start)); executed 128 times by 2 tests: entry = scope.engine->newString(string.mid(start, end - start)); Executed by:
| 128 | ||||||||||||||||||
746 | arguments[k] = entry; | - | ||||||||||||||||||
747 | } executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||||||||
748 | uint matchStart = matchOffsets[i * numCaptures * 2]; | - | ||||||||||||||||||
749 | ((matchStart >= static_cast<uint>(lastEnd)) ? static_cast<void>(0) : qt_assert("matchStart >= static_cast<uint>(lastEnd)", __FILE__, 802)); | - | ||||||||||||||||||
750 | uint matchEnd = matchOffsets[i * numCaptures * 2 + 1]; | - | ||||||||||||||||||
751 | arguments[numCaptures] = Primitive::fromUInt32(matchStart); | - | ||||||||||||||||||
752 | arguments[numCaptures + 1] = scope.engine->newString(string); | - | ||||||||||||||||||
753 | - | |||||||||||||||||||
754 | Value that = Primitive::undefinedValue(); | - | ||||||||||||||||||
755 | replacement = searchCallback->call(&that, arguments, numCaptures + 2); | - | ||||||||||||||||||
756 | result += string.midRef(lastEnd, matchStart - lastEnd); | - | ||||||||||||||||||
757 | result += replacement->toQString(); | - | ||||||||||||||||||
758 | lastEnd = matchEnd; | - | ||||||||||||||||||
759 | } executed 74 times by 2 tests: end of block Executed by:
| 74 | ||||||||||||||||||
760 | result += string.midRef(lastEnd); | - | ||||||||||||||||||
761 | } executed 64 times by 2 tests: else {end of block Executed by:
| 64 | ||||||||||||||||||
762 | QString newString = replaceValue->toQString(); | - | ||||||||||||||||||
763 | result.reserve(string.length() + numStringMatches*newString.size()); | - | ||||||||||||||||||
764 | - | |||||||||||||||||||
765 | int lastEnd = 0; | - | ||||||||||||||||||
766 | for (int i = 0; i < numStringMatches
| 780-2216 | ||||||||||||||||||
767 | int baseIndex = i * numCaptures * 2; | - | ||||||||||||||||||
768 | uint matchStart = matchOffsets[baseIndex]; | - | ||||||||||||||||||
769 | uint matchEnd = matchOffsets[baseIndex + 1]; | - | ||||||||||||||||||
770 | if (matchStart == JSC::Yarr::offsetNoMatch
| 0-780 | ||||||||||||||||||
771 | continue; never executed: continue; | 0 | ||||||||||||||||||
772 | - | |||||||||||||||||||
773 | result += string.midRef(lastEnd, matchStart - lastEnd); | - | ||||||||||||||||||
774 | appendReplacementString(&result, string, newString, matchOffsets + baseIndex, numCaptures); | - | ||||||||||||||||||
775 | lastEnd = matchEnd; | - | ||||||||||||||||||
776 | } executed 780 times by 1 test: end of block Executed by:
| 780 | ||||||||||||||||||
777 | result += string.midRef(lastEnd); | - | ||||||||||||||||||
778 | } executed 2216 times by 2 tests: end of block Executed by:
| 2216 | ||||||||||||||||||
779 | - | |||||||||||||||||||
780 | if (matchOffsets != _matchOffsets
| 0-2280 | ||||||||||||||||||
781 | free(matchOffsets); never executed: free(matchOffsets); | 0 | ||||||||||||||||||
782 | - | |||||||||||||||||||
783 | return executed 2280 times by 3 tests: Encode(scope.engine->newString(result));return Encode(scope.engine->newString(result)); Executed by:
executed 2280 times by 3 tests: return Encode(scope.engine->newString(result)); Executed by:
| 2280 | ||||||||||||||||||
784 | } | - | ||||||||||||||||||
785 | - | |||||||||||||||||||
786 | ReturnedValue StringPrototype::method_search(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
787 | { | - | ||||||||||||||||||
788 | Scope scope(b); | - | ||||||||||||||||||
789 | QString string = getThisString(scope.engine, thisObject); | - | ||||||||||||||||||
790 | if (scope.engine->hasException
| 8-112 | ||||||||||||||||||
791 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
792 | - | |||||||||||||||||||
793 | Scoped<RegExpObject> regExp(scope, argc ? argv[0] : Primitive::undefinedValue()); | - | ||||||||||||||||||
794 | if (!regExp
| 32-80 | ||||||||||||||||||
795 | regExp = scope.engine->regExpCtor()->callAsConstructor(argv, 1); | - | ||||||||||||||||||
796 | if (scope.engine->hasException
| 7-72 | ||||||||||||||||||
797 | return executed 7 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 7 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 7 | ||||||||||||||||||
798 | - | |||||||||||||||||||
799 | ((regExp) ? static_cast<void>(0) : qt_assert("regExp", __FILE__, 852)); | - | ||||||||||||||||||
800 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||
801 | Scoped<RegExp> re(scope, regExp->value()); | - | ||||||||||||||||||
802 | uint *matchOffsets = 0; matchOffsets = static_cast<uint*>( | - | ||||||||||||||||||
803 | __builtin_alloca ( | - | ||||||||||||||||||
804 | regExp->value()->captureCount() * 2 * sizeof(uint) | - | ||||||||||||||||||
805 | ) | - | ||||||||||||||||||
806 | ); | - | ||||||||||||||||||
807 | uint result = re->match(string, 0, matchOffsets); | - | ||||||||||||||||||
808 | if (result == JSC::Yarr::offsetNoMatch
| 16-88 | ||||||||||||||||||
809 | return executed 16 times by 1 test: Encode(-1);return Encode(-1); Executed by:
executed 16 times by 1 test: return Encode(-1); Executed by:
| 16 | ||||||||||||||||||
810 | else | - | ||||||||||||||||||
811 | return executed 88 times by 1 test: Encode(result);return Encode(result); Executed by:
executed 88 times by 1 test: return Encode(result); Executed by:
| 88 | ||||||||||||||||||
812 | } | - | ||||||||||||||||||
813 | - | |||||||||||||||||||
814 | ReturnedValue StringPrototype::method_slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
815 | { | - | ||||||||||||||||||
816 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
817 | Scope scope(v4); | - | ||||||||||||||||||
818 | ScopedString s(scope, thisAsString(v4, thisObject)); | - | ||||||||||||||||||
819 | if (v4->hasException
| 0-280 | ||||||||||||||||||
820 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||||||||
821 | ((s) ? static_cast<void>(0) : qt_assert("s", __FILE__, 870)); | - | ||||||||||||||||||
822 | - | |||||||||||||||||||
823 | const double length = s->d()->length(); | - | ||||||||||||||||||
824 | - | |||||||||||||||||||
825 | double start = argc
| 8-272 | ||||||||||||||||||
826 | double end = (argc < 2
| 12-264 | ||||||||||||||||||
827 | ? length : argv[1].toInteger(); | - | ||||||||||||||||||
828 | - | |||||||||||||||||||
829 | if (start < 0
| 12-268 | ||||||||||||||||||
830 | start = qMax(length + start, 0.); executed 12 times by 1 test: start = qMax(length + start, 0.); Executed by:
| 12 | ||||||||||||||||||
831 | else | - | ||||||||||||||||||
832 | start = qMin(start, length); executed 268 times by 1 test: start = qMin(start, length); Executed by:
| 268 | ||||||||||||||||||
833 | - | |||||||||||||||||||
834 | if (end < 0
| 116-164 | ||||||||||||||||||
835 | end = qMax(length + end, 0.); executed 164 times by 1 test: end = qMax(length + end, 0.); Executed by:
| 164 | ||||||||||||||||||
836 | else | - | ||||||||||||||||||
837 | end = qMin(end, length); executed 116 times by 1 test: end = qMin(end, length); Executed by:
| 116 | ||||||||||||||||||
838 | - | |||||||||||||||||||
839 | const int intStart = int(start); | - | ||||||||||||||||||
840 | const int intEnd = int(end); | - | ||||||||||||||||||
841 | - | |||||||||||||||||||
842 | int count = qMax(0, intEnd - intStart); | - | ||||||||||||||||||
843 | return executed 280 times by 1 test: Encode(v4->memoryManager->alloc<ComplexString>(s->d(), intStart, count));return Encode(v4->memoryManager->alloc<ComplexString>(s->d(), intStart, count)); Executed by:
executed 280 times by 1 test: return Encode(v4->memoryManager->alloc<ComplexString>(s->d(), intStart, count)); Executed by:
| 280 | ||||||||||||||||||
844 | } | - | ||||||||||||||||||
845 | - | |||||||||||||||||||
846 | ReturnedValue StringPrototype::method_split(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
847 | { | - | ||||||||||||||||||
848 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
849 | QString text = getThisString(v4, thisObject); | - | ||||||||||||||||||
850 | if (v4->hasException
| 8-486 | ||||||||||||||||||
851 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
852 | - | |||||||||||||||||||
853 | Scope scope(v4); | - | ||||||||||||||||||
854 | ScopedValue separatorValue(scope, argc ? argv[0] : Primitive::undefinedValue()); | - | ||||||||||||||||||
855 | ScopedValue limitValue(scope, argc > 1 ? argv[1] : Primitive::undefinedValue()); | - | ||||||||||||||||||
856 | - | |||||||||||||||||||
857 | ScopedArrayObject array(scope, scope.engine->newArrayObject()); | - | ||||||||||||||||||
858 | - | |||||||||||||||||||
859 | if (separatorValue->isUndefined()
| 71-420 | ||||||||||||||||||
860 | if (limitValue->isUndefined()
| 0-72 | ||||||||||||||||||
861 | ScopedString s(scope, scope.engine->newString(text)); | - | ||||||||||||||||||
862 | array->push_back(s); | - | ||||||||||||||||||
863 | return executed 70 times by 1 test: array.asReturnedValue();return array.asReturnedValue(); Executed by:
executed 70 times by 1 test: return array.asReturnedValue(); Executed by:
| 70 | ||||||||||||||||||
864 | } | - | ||||||||||||||||||
865 | return never executed: QV4::Encode(scope.engine->newString(text.left(limitValue->toInteger())));return QV4::Encode(scope.engine->newString(text.left(limitValue->toInteger()))); never executed: return QV4::Encode(scope.engine->newString(text.left(limitValue->toInteger()))); | 0 | ||||||||||||||||||
866 | } | - | ||||||||||||||||||
867 | - | |||||||||||||||||||
868 | uint limit = limitValue->isUndefined()
| 152-268 | ||||||||||||||||||
869 | (0x7fffffff * 2U + 1U) | - | ||||||||||||||||||
870 | : limitValue->toUInt32(); | - | ||||||||||||||||||
871 | - | |||||||||||||||||||
872 | if (limit == 0
| 60-358 | ||||||||||||||||||
873 | return executed 60 times by 1 test: array.asReturnedValue();return array.asReturnedValue(); Executed by:
executed 60 times by 1 test: return array.asReturnedValue(); Executed by:
| 60 | ||||||||||||||||||
874 | - | |||||||||||||||||||
875 | Scoped<RegExpObject> re(scope, separatorValue); | - | ||||||||||||||||||
876 | if (re
| 104-256 | ||||||||||||||||||
877 | if (re->value()->pattern->isEmpty()
| 31-72 | ||||||||||||||||||
878 | re = (RegExpObject *)nullptr; | - | ||||||||||||||||||
879 | separatorValue = scope.engine->newString(); | - | ||||||||||||||||||
880 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||
881 | } executed 104 times by 1 test: end of block Executed by:
| 104 | ||||||||||||||||||
882 | - | |||||||||||||||||||
883 | ScopedString s(scope); | - | ||||||||||||||||||
884 | if (re
| 72-286 | ||||||||||||||||||
885 | uint offset = 0; | - | ||||||||||||||||||
886 | uint *matchOffsets = 0; matchOffsets = static_cast<uint*>( | - | ||||||||||||||||||
887 | __builtin_alloca ( | - | ||||||||||||||||||
888 | re->value()->captureCount() * 2 * sizeof(uint) | - | ||||||||||||||||||
889 | ) | - | ||||||||||||||||||
890 | ); | - | ||||||||||||||||||
891 | while (true) { | - | ||||||||||||||||||
892 | Scoped<RegExp> regexp(scope, re->value()); | - | ||||||||||||||||||
893 | uint result = regexp->match(text, offset, matchOffsets); | - | ||||||||||||||||||
894 | if (result == JSC::Yarr::offsetNoMatch
| 52-160 | ||||||||||||||||||
895 | break; executed 52 times by 1 test: break; Executed by:
| 52 | ||||||||||||||||||
896 | - | |||||||||||||||||||
897 | array->push_back((s = scope.engine->newString(text.mid(offset, matchOffsets[0] - offset)))); | - | ||||||||||||||||||
898 | offset = qMax(offset + 1, matchOffsets[1]); | - | ||||||||||||||||||
899 | - | |||||||||||||||||||
900 | if (array->getLength() >= limit
| 20-140 | ||||||||||||||||||
901 | break; executed 20 times by 1 test: break; Executed by:
| 20 | ||||||||||||||||||
902 | - | |||||||||||||||||||
903 | for (int i = 1; i < re->value()->captureCount()
| 0-140 | ||||||||||||||||||
904 | uint start = matchOffsets[i * 2]; | - | ||||||||||||||||||
905 | uint end = matchOffsets[i * 2 + 1]; | - | ||||||||||||||||||
906 | array->push_back((s = scope.engine->newString(text.mid(start, end - start)))); | - | ||||||||||||||||||
907 | if (array->getLength() >= limit
| 0 | ||||||||||||||||||
908 | break; never executed: break; | 0 | ||||||||||||||||||
909 | } never executed: end of block | 0 | ||||||||||||||||||
910 | } executed 140 times by 1 test: end of block Executed by:
| 140 | ||||||||||||||||||
911 | if (array->getLength() < limit
| 20-52 | ||||||||||||||||||
912 | array->push_back((s = scope.engine->newString(text.mid(offset)))); executed 52 times by 1 test: array->push_back((s = scope.engine->newString(text.mid(offset)))); Executed by:
| 52 | ||||||||||||||||||
913 | } executed 72 times by 1 test: else {end of block Executed by:
| 72 | ||||||||||||||||||
914 | QString separator = separatorValue->toQString(); | - | ||||||||||||||||||
915 | if (separator.isEmpty()
| 47-240 | ||||||||||||||||||
916 | for (uint i = 0; i < qMin(limit, uint(text.length()))
| 48-307 | ||||||||||||||||||
917 | array->push_back((s = scope.engine->newString(text.mid(i, 1)))); executed 307 times by 1 test: array->push_back((s = scope.engine->newString(text.mid(i, 1)))); Executed by:
| 307 | ||||||||||||||||||
918 | return executed 48 times by 1 test: array.asReturnedValue();return array.asReturnedValue(); Executed by:
executed 48 times by 1 test: return array.asReturnedValue(); Executed by:
| 48 | ||||||||||||||||||
919 | } | - | ||||||||||||||||||
920 | - | |||||||||||||||||||
921 | int start = 0; | - | ||||||||||||||||||
922 | int end; | - | ||||||||||||||||||
923 | while ((
| 211-368 | ||||||||||||||||||
924 | array->push_back((s = scope.engine->newString(text.mid(start, end - start)))); | - | ||||||||||||||||||
925 | start = end + separator.size(); | - | ||||||||||||||||||
926 | if (array->getLength() >= limit
| 28-340 | ||||||||||||||||||
927 | break; executed 28 times by 1 test: break; Executed by:
| 28 | ||||||||||||||||||
928 | } executed 340 times by 3 tests: end of block Executed by:
| 340 | ||||||||||||||||||
929 | if (array->getLength() < limit
| 0-211 | ||||||||||||||||||
930 | array->push_back((s = scope.engine->newString(text.mid(start)))); executed 212 times by 3 tests: array->push_back((s = scope.engine->newString(text.mid(start)))); Executed by:
| 212 | ||||||||||||||||||
931 | } executed 240 times by 3 tests: end of block Executed by:
| 240 | ||||||||||||||||||
932 | return executed 312 times by 3 tests: array.asReturnedValue();return array.asReturnedValue(); Executed by:
executed 312 times by 3 tests: return array.asReturnedValue(); Executed by:
| 312 | ||||||||||||||||||
933 | } | - | ||||||||||||||||||
934 | - | |||||||||||||||||||
935 | ReturnedValue StringPrototype::method_startsWith(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
936 | { | - | ||||||||||||||||||
937 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
938 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
939 | if (v4->hasException
| 16-148 | ||||||||||||||||||
940 | return executed 16 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 16 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 16 | ||||||||||||||||||
941 | - | |||||||||||||||||||
942 | if (argc
| 0-148 | ||||||||||||||||||
943 | return executed 8 times by 1 test: v4->throwTypeError();return v4->throwTypeError(); Executed by:
executed 8 times by 1 test: return v4->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
944 | QString searchString = (argc
| 0-140 | ||||||||||||||||||
945 | if (v4->hasException
| 8-132 | ||||||||||||||||||
946 | return executed 8 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 8 times by 1 test: return Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
947 | - | |||||||||||||||||||
948 | int pos = 0; | - | ||||||||||||||||||
949 | if (argc > 1
| 36-96 | ||||||||||||||||||
950 | pos = (int) argv[1].toInteger(); executed 96 times by 1 test: pos = (int) argv[1].toInteger(); Executed by:
| 96 | ||||||||||||||||||
951 | - | |||||||||||||||||||
952 | if (pos == 0
| 56-76 | ||||||||||||||||||
953 | return executed 76 times by 1 test: Encode(value.startsWith(searchString));return Encode(value.startsWith(searchString)); Executed by:
executed 76 times by 1 test: return Encode(value.startsWith(searchString)); Executed by:
| 76 | ||||||||||||||||||
954 | - | |||||||||||||||||||
955 | QStringRef stringToSearch = value.midRef(pos); | - | ||||||||||||||||||
956 | return executed 56 times by 1 test: QV4::Encode(Encode(stringToSearch.startsWith(searchString)));return QV4::Encode(Encode(stringToSearch.startsWith(searchString))); Executed by:
executed 56 times by 1 test: return QV4::Encode(Encode(stringToSearch.startsWith(searchString))); Executed by:
| 56 | ||||||||||||||||||
957 | } | - | ||||||||||||||||||
958 | - | |||||||||||||||||||
959 | ReturnedValue StringPrototype::method_substr(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
960 | { | - | ||||||||||||||||||
961 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
962 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
963 | if (v4->hasException
| 0-40 | ||||||||||||||||||
964 | return never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: return QV4::Encode::undefined(); | 0 | ||||||||||||||||||
965 | - | |||||||||||||||||||
966 | double start = 0; | - | ||||||||||||||||||
967 | if (argc > 0
| 0-40 | ||||||||||||||||||
968 | start = argv[0].toInteger(); executed 40 times by 3 tests: start = argv[0].toInteger(); Executed by:
| 40 | ||||||||||||||||||
969 | - | |||||||||||||||||||
970 | double length = +qInf(); | - | ||||||||||||||||||
971 | if (argc > 1
| 4-36 | ||||||||||||||||||
972 | length = argv[1].toInteger(); executed 36 times by 3 tests: length = argv[1].toInteger(); Executed by:
| 36 | ||||||||||||||||||
973 | - | |||||||||||||||||||
974 | double count = value.length(); | - | ||||||||||||||||||
975 | if (start < 0
| 0-40 | ||||||||||||||||||
976 | start = qMax(count + start, 0.0); never executed: start = qMax(count + start, 0.0); | 0 | ||||||||||||||||||
977 | - | |||||||||||||||||||
978 | length = qMin(qMax(length, 0.0), count - start); | - | ||||||||||||||||||
979 | - | |||||||||||||||||||
980 | qint32 x = Primitive::toInt32(start); | - | ||||||||||||||||||
981 | qint32 y = Primitive::toInt32(length); | - | ||||||||||||||||||
982 | return executed 40 times by 3 tests: Encode(v4->newString(value.mid(x, y)));return Encode(v4->newString(value.mid(x, y))); Executed by:
executed 40 times by 3 tests: return Encode(v4->newString(value.mid(x, y))); Executed by:
| 40 | ||||||||||||||||||
983 | } | - | ||||||||||||||||||
984 | - | |||||||||||||||||||
985 | ReturnedValue StringPrototype::method_substring(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
986 | { | - | ||||||||||||||||||
987 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
988 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
989 | if (v4->hasException
| 8-191 | ||||||||||||||||||
990 | return executed 8 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 8 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 8 | ||||||||||||||||||
991 | - | |||||||||||||||||||
992 | int length = value.length(); | - | ||||||||||||||||||
993 | - | |||||||||||||||||||
994 | double start = 0; | - | ||||||||||||||||||
995 | double end = length; | - | ||||||||||||||||||
996 | - | |||||||||||||||||||
997 | if (argc > 0
| 8-184 | ||||||||||||||||||
998 | start = argv[0].toInteger(); executed 184 times by 1 test: start = argv[0].toInteger(); Executed by:
| 184 | ||||||||||||||||||
999 | - | |||||||||||||||||||
1000 | if (argc > 1
| 12-179 | ||||||||||||||||||
1001 | end = argv[1].toInteger(); executed 164 times by 1 test: end = argv[1].toInteger(); Executed by:
| 164 | ||||||||||||||||||
1002 | - | |||||||||||||||||||
1003 | if (std::isnan(start)
| 0-192 | ||||||||||||||||||
1004 | start = 0; executed 20 times by 1 test: start = 0; Executed by:
| 20 | ||||||||||||||||||
1005 | - | |||||||||||||||||||
1006 | if (std::isnan(end)
| 0-192 | ||||||||||||||||||
1007 | end = 0; executed 24 times by 1 test: end = 0; Executed by:
| 24 | ||||||||||||||||||
1008 | - | |||||||||||||||||||
1009 | if (start > length
| 28-164 | ||||||||||||||||||
1010 | start = length; executed 28 times by 1 test: start = length; Executed by:
| 28 | ||||||||||||||||||
1011 | - | |||||||||||||||||||
1012 | if (end > length
| 20-172 | ||||||||||||||||||
1013 | end = length; executed 20 times by 1 test: end = length; Executed by:
| 20 | ||||||||||||||||||
1014 | - | |||||||||||||||||||
1015 | if (start > end
| 36-156 | ||||||||||||||||||
1016 | double was = start; | - | ||||||||||||||||||
1017 | start = end; | - | ||||||||||||||||||
1018 | end = was; | - | ||||||||||||||||||
1019 | } executed 36 times by 1 test: end of block Executed by:
| 36 | ||||||||||||||||||
1020 | - | |||||||||||||||||||
1021 | qint32 x = (int)start; | - | ||||||||||||||||||
1022 | qint32 y = (int)(end - start); | - | ||||||||||||||||||
1023 | return executed 191 times by 1 test: Encode(v4->newString(value.mid(x, y)));return Encode(v4->newString(value.mid(x, y))); Executed by:
executed 191 times by 1 test: return Encode(v4->newString(value.mid(x, y))); Executed by:
| 191 | ||||||||||||||||||
1024 | } | - | ||||||||||||||||||
1025 | - | |||||||||||||||||||
1026 | ReturnedValue StringPrototype::method_toLowerCase(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||||||||
1027 | { | - | ||||||||||||||||||
1028 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
1029 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
1030 | if (v4->hasException
| 32-1292 | ||||||||||||||||||
1031 | return executed 32 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 32 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 32 | ||||||||||||||||||
1032 | - | |||||||||||||||||||
1033 | return executed 1292 times by 1 test: Encode(v4->newString(value.toLower()));return Encode(v4->newString(value.toLower())); Executed by:
executed 1292 times by 1 test: return Encode(v4->newString(value.toLower())); Executed by:
| 1292 | ||||||||||||||||||
1034 | } | - | ||||||||||||||||||
1035 | - | |||||||||||||||||||
1036 | ReturnedValue StringPrototype::method_toLocaleLowerCase(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
1037 | { | - | ||||||||||||||||||
1038 | return executed 658 times by 1 test: method_toLowerCase(b, thisObject, argv, argc);return method_toLowerCase(b, thisObject, argv, argc); Executed by:
executed 658 times by 1 test: return method_toLowerCase(b, thisObject, argv, argc); Executed by:
| 658 | ||||||||||||||||||
1039 | } | - | ||||||||||||||||||
1040 | - | |||||||||||||||||||
1041 | ReturnedValue StringPrototype::method_toUpperCase(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||||||||
1042 | { | - | ||||||||||||||||||
1043 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
1044 | const QString value = getThisString(v4, thisObject); | - | ||||||||||||||||||
1045 | if (v4->hasException
| 32-557416 | ||||||||||||||||||
1046 | return executed 32 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 32 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 32 | ||||||||||||||||||
1047 | - | |||||||||||||||||||
1048 | return executed 557416 times by 2 tests: Encode(v4->newString(value.toUpper()));return Encode(v4->newString(value.toUpper())); Executed by:
executed 557416 times by 2 tests: return Encode(v4->newString(value.toUpper())); Executed by:
| 557416 | ||||||||||||||||||
1049 | } | - | ||||||||||||||||||
1050 | - | |||||||||||||||||||
1051 | ReturnedValue StringPrototype::method_toLocaleUpperCase(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||
1052 | { | - | ||||||||||||||||||
1053 | return executed 652 times by 1 test: method_toUpperCase(b, thisObject, argv, argc);return method_toUpperCase(b, thisObject, argv, argc); Executed by:
executed 652 times by 1 test: return method_toUpperCase(b, thisObject, argv, argc); Executed by:
| 652 | ||||||||||||||||||
1054 | } | - | ||||||||||||||||||
1055 | - | |||||||||||||||||||
1056 | ReturnedValue StringPrototype::method_trim(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||||||||
1057 | { | - | ||||||||||||||||||
1058 | ExecutionEngine *v4 = b->engine(); | - | ||||||||||||||||||
1059 | QString s = getThisString(v4, thisObject); | - | ||||||||||||||||||
1060 | if (v4->hasException
| 11-500 | ||||||||||||||||||
1061 | return executed 11 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined(); Executed by:
executed 11 times by 1 test: return QV4::Encode::undefined(); Executed by:
| 11 | ||||||||||||||||||
1062 | - | |||||||||||||||||||
1063 | const QChar *chars = s.constData(); | - | ||||||||||||||||||
1064 | int start, end; | - | ||||||||||||||||||
1065 | for (start = 0; start < s.length()
| 63-1163 | ||||||||||||||||||
1066 | if (!chars[start].isSpace()
| 28-703 | ||||||||||||||||||
1067 | break; executed 435 times by 1 test: break; Executed by:
| 435 | ||||||||||||||||||
1068 | } executed 731 times by 1 test: end of block Executed by:
| 731 | ||||||||||||||||||
1069 | for (end = s.length() - 1; end >= start
| 63-776 | ||||||||||||||||||
1070 | if (!chars[end].isSpace()
| 12-448 | ||||||||||||||||||
1071 | break; executed 436 times by 1 test: break; Executed by:
| 436 | ||||||||||||||||||
1072 | } executed 343 times by 1 test: end of block Executed by:
| 343 | ||||||||||||||||||
1073 | - | |||||||||||||||||||
1074 | return executed 498 times by 1 test: Encode(v4->newString(QString(chars + start, end - start + 1)));return Encode(v4->newString(QString(chars + start, end - start + 1))); Executed by:
executed 498 times by 1 test: return Encode(v4->newString(QString(chars + start, end - start + 1))); Executed by:
| 498 | ||||||||||||||||||
1075 | } | - | ||||||||||||||||||
1076 | - | |||||||||||||||||||
1077 | - | |||||||||||||||||||
1078 | - | |||||||||||||||||||
1079 | ReturnedValue StringPrototype::method_iterator(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||||||||
1080 | { | - | ||||||||||||||||||
1081 | Scope scope(b); | - | ||||||||||||||||||
1082 | ScopedString s(scope, thisObject->toString(scope.engine)); | - | ||||||||||||||||||
1083 | if (!s
| 0-94 | ||||||||||||||||||
1084 | return executed 8 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 8 | ||||||||||||||||||
1085 | - | |||||||||||||||||||
1086 | Scoped<StringIteratorObject> si(scope, scope.engine->memoryManager->allocate<StringIteratorObject>(s->d(), scope.engine)); | - | ||||||||||||||||||
1087 | return executed 86 times by 1 test: si->asReturnedValue();return si->asReturnedValue(); Executed by:
executed 86 times by 1 test: return si->asReturnedValue(); Executed by:
| 86 | ||||||||||||||||||
1088 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |