Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4mapobject.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | using namespace QV4; | - | ||||||||||||
3 | - | |||||||||||||
4 | const QV4::VTable MapCtor::static_vtbl = { (std::is_same<MapCtor::SuperClass, Object>::value) ? nullptr : &MapCtor::SuperClass::static_vtbl, (sizeof(MapCtor::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(MapCtor::Data) + (MapCtor::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(MapCtor::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), MapCtor::IsExecutionContext, MapCtor::IsString, MapCtor::IsObject, MapCtor::IsFunctionObject, MapCtor::IsErrorObject, MapCtor::IsArrayData, MapCtor::IsStringOrSymbol, MapCtor::MyType, { 0, 0, 0, 0 }, "MapCtor", MapCtor::virtualDestroy, MapCtor::Data::markObjects, MapCtor::virtualIsEqualTo, MapCtor::virtualGet, MapCtor::virtualPut, MapCtor::virtualDeleteProperty, MapCtor::virtualHasProperty, MapCtor::virtualGetOwnProperty, MapCtor::virtualDefineOwnProperty, MapCtor::virtualIsExtensible, MapCtor::virtualPreventExtensions, MapCtor::virtualGetPrototypeOf, MapCtor::virtualSetPrototypeOf, MapCtor::virtualGetLength, MapCtor::virtualAdvanceIterator, MapCtor::virtualInstanceOf, MapCtor::virtualCall, MapCtor::virtualCallAsConstructor, }; | - | ||||||||||||
5 | const QV4::VTable MapObject::static_vtbl = { (std::is_same<MapObject::SuperClass, Object>::value) ? nullptr : &MapObject::SuperClass::static_vtbl, (sizeof(MapObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(MapObject::Data) + (MapObject::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(MapObject::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), MapObject::IsExecutionContext, MapObject::IsString, MapObject::IsObject, MapObject::IsFunctionObject, MapObject::IsErrorObject, MapObject::IsArrayData, MapObject::IsStringOrSymbol, MapObject::MyType, { 0, 0, 0, 0 }, "MapObject", MapObject::virtualDestroy, MapObject::Data::markObjects, MapObject::virtualIsEqualTo, MapObject::virtualGet, MapObject::virtualPut, MapObject::virtualDeleteProperty, MapObject::virtualHasProperty, MapObject::virtualGetOwnProperty, MapObject::virtualDefineOwnProperty, MapObject::virtualIsExtensible, MapObject::virtualPreventExtensions, MapObject::virtualGetPrototypeOf, MapObject::virtualSetPrototypeOf, MapObject::virtualGetLength, MapObject::virtualAdvanceIterator, MapObject::virtualInstanceOf, MapObject::virtualCall, MapObject::virtualCallAsConstructor, }; | - | ||||||||||||
6 | - | |||||||||||||
7 | void Heap::MapCtor::init(QV4::ExecutionContext *scope) | - | ||||||||||||
8 | { | - | ||||||||||||
9 | Heap::FunctionObject::init(scope, ([]() noexcept -> QString { enum { Size = sizeof(u"" "Map")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Map" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98564 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98564 times by 153 tests: }()));return qstring_literal_temp; Executed by:
| 98564 | ||||||||||||
10 | } executed 98827 times by 153 tests: end of block Executed by:
| 98827 | ||||||||||||
11 | - | |||||||||||||
12 | ReturnedValue MapCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *) | - | ||||||||||||
13 | { | - | ||||||||||||
14 | Scope scope(f); | - | ||||||||||||
15 | Scoped<MapObject> a(scope, scope.engine->memoryManager->allocate<MapObject>()); | - | ||||||||||||
16 | - | |||||||||||||
17 | if (argc > 0
| 146-346 | ||||||||||||
18 | ScopedValue iterable(scope, argv[0]); | - | ||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | Scoped<MapObject> mapObjectCheck(scope, argv[0]); | - | ||||||||||||
26 | Scoped<SetObject> setObjectCheck(scope, argv[0]); | - | ||||||||||||
27 | - | |||||||||||||
28 | if (!iterable->isUndefined()
| 4-142 | ||||||||||||
29 | ScopedFunctionObject adder(scope, a->get(ScopedString(scope, scope.engine->newString(QString::fromLatin1("set"))))); | - | ||||||||||||
30 | if (!adder
| 0 | ||||||||||||
31 | return never executed: scope.engine->throwTypeError();return scope.engine->throwTypeError(); never executed: return scope.engine->throwTypeError(); | 0 | ||||||||||||
32 | ScopedObject iter(scope, Runtime::method_getIterator(scope.engine, iterable, true)); | - | ||||||||||||
33 | - | |||||||||||||
34 | do { if (scope.hasException()
never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: } } while (false);return QV4::Encode::undefined(); | 0 | ||||||||||||
35 | if (!iter
| 0 | ||||||||||||
36 | return never executed: a.asReturnedValue();return a.asReturnedValue(); never executed: return a.asReturnedValue(); | 0 | ||||||||||||
37 | - | |||||||||||||
38 | Value *nextValue = scope.alloc(1); | - | ||||||||||||
39 | ScopedValue done(scope); | - | ||||||||||||
40 | for(;;) { | - | ||||||||||||
41 | done = Runtime::method_iteratorNext(scope.engine, iter, nextValue); | - | ||||||||||||
42 | do { if (scope.hasException()
never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: } } while (false);return QV4::Encode::undefined(); | 0 | ||||||||||||
43 | if (done->toBoolean()
| 0 | ||||||||||||
44 | return never executed: a.asReturnedValue();return a.asReturnedValue(); never executed: return a.asReturnedValue(); | 0 | ||||||||||||
45 | - | |||||||||||||
46 | adder->call(a, nextValue, 1); | - | ||||||||||||
47 | if (scope.engine->hasException
| 0 | ||||||||||||
48 | ScopedValue falsey(scope, Encode(false)); | - | ||||||||||||
49 | return never executed: Runtime::method_iteratorClose(scope.engine, iter, falsey);return Runtime::method_iteratorClose(scope.engine, iter, falsey); never executed: return Runtime::method_iteratorClose(scope.engine, iter, falsey); | 0 | ||||||||||||
50 | } | - | ||||||||||||
51 | } never executed: end of block | 0 | ||||||||||||
52 | } never executed: end of block | 0 | ||||||||||||
53 | } executed 146 times by 1 test: end of block Executed by:
| 146 | ||||||||||||
54 | return executed 492 times by 1 test: a.asReturnedValue();return a.asReturnedValue(); Executed by:
executed 492 times by 1 test: return a.asReturnedValue(); Executed by:
| 492 | ||||||||||||
55 | } | - | ||||||||||||
56 | - | |||||||||||||
57 | ReturnedValue MapCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int) | - | ||||||||||||
58 | { | - | ||||||||||||
59 | Scope scope(f); | - | ||||||||||||
60 | return executed 8 times by 1 test: scope.engine->throwTypeError(QString::fromLatin1("Map requires new"));return scope.engine->throwTypeError(QString::fromLatin1("Map requires new")); Executed by:
executed 8 times by 1 test: return scope.engine->throwTypeError(QString::fromLatin1("Map requires new")); Executed by:
| 8 | ||||||||||||
61 | } | - | ||||||||||||
62 | - | |||||||||||||
63 | void MapPrototype::init(ExecutionEngine *engine, Object *ctor) | - | ||||||||||||
64 | { | - | ||||||||||||
65 | Scope scope(engine); | - | ||||||||||||
66 | ScopedObject o(scope); | - | ||||||||||||
67 | ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0)); | - | ||||||||||||
68 | ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); | - | ||||||||||||
69 | ctor->addSymbolSpecies(); | - | ||||||||||||
70 | defineDefaultProperty(engine->id_constructor(), (o = ctor)); | - | ||||||||||||
71 | - | |||||||||||||
72 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "clear")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "clear" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98918 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98918 times by 153 tests: }()), method_clear, 0);return qstring_literal_temp; Executed by:
| 98918 | ||||||||||||
73 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "delete")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "delete" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99001 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99001 times by 153 tests: }()), method_delete, 1);return qstring_literal_temp; Executed by:
| 99001 | ||||||||||||
74 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "forEach")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "forEach" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 99100 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 99100 times by 153 tests: }()), method_forEach, 1);return qstring_literal_temp; Executed by:
| 99100 | ||||||||||||
75 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "get")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "get" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98591 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98591 times by 153 tests: }()), method_get, 1);return qstring_literal_temp; Executed by:
| 98591 | ||||||||||||
76 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "has")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "has" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98947 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98947 times by 153 tests: }()), method_has, 1);return qstring_literal_temp; Executed by:
| 98947 | ||||||||||||
77 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "keys")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "keys" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98979 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98979 times by 153 tests: }()), method_keys, 0);return qstring_literal_temp; Executed by:
| 98979 | ||||||||||||
78 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "set")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "set" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98922 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98922 times by 153 tests: }()), method_set, 0);return qstring_literal_temp; Executed by:
| 98922 | ||||||||||||
79 | defineAccessorProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "size")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "size" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98956 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98956 times by 153 tests: }()), method_get_size, nullptr);return qstring_literal_temp; Executed by:
| 98956 | ||||||||||||
80 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "values")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "values" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98569 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98569 times by 153 tests: }()), method_values, 0);return qstring_literal_temp; Executed by:
| 98569 | ||||||||||||
81 | - | |||||||||||||
82 | - | |||||||||||||
83 | ScopedString valString(scope, scope.engine->newIdentifier(([]() noexcept -> QString { enum { Size = sizeof(u"" "entries")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "entries" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98859 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98859 times by 153 tests: }())));return qstring_literal_temp; Executed by:
| 98859 | ||||||||||||
84 | ScopedFunctionObject entriesFn(scope, FunctionObject::createBuiltinFunction(engine, valString, MapPrototype::method_entries, 0)); | - | ||||||||||||
85 | defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "entries")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "entries" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98760 times by 153 tests: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 98760 times by 153 tests: }()), entriesFn);return qstring_literal_temp; Executed by:
| 98760 | ||||||||||||
86 | defineDefaultProperty(engine->symbol_iterator(), entriesFn); | - | ||||||||||||
87 | - | |||||||||||||
88 | ScopedString val(scope, engine->newString(QLatin1String("Map"))); | - | ||||||||||||
89 | defineReadonlyConfigurableProperty(engine->symbol_toStringTag(), val); | - | ||||||||||||
90 | } executed 99047 times by 153 tests: end of block Executed by:
| 99047 | ||||||||||||
91 | - | |||||||||||||
92 | void Heap::MapObject::init() | - | ||||||||||||
93 | { | - | ||||||||||||
94 | Object::init(); | - | ||||||||||||
95 | esTable = new ESTable(); | - | ||||||||||||
96 | } executed 492 times by 1 test: end of block Executed by:
| 492 | ||||||||||||
97 | - | |||||||||||||
98 | void Heap::MapObject::destroy() | - | ||||||||||||
99 | { | - | ||||||||||||
100 | delete esTable; | - | ||||||||||||
101 | esTable = 0; | - | ||||||||||||
102 | } executed 494 times by 1 test: end of block Executed by:
| 494 | ||||||||||||
103 | - | |||||||||||||
104 | void Heap::MapObject::markObjects(Heap::Base *that, MarkStack *markStack) | - | ||||||||||||
105 | { | - | ||||||||||||
106 | MapObject *m = static_cast<MapObject *>(that); | - | ||||||||||||
107 | m->esTable->markObjects(markStack); | - | ||||||||||||
108 | Object::markObjects(that, markStack); | - | ||||||||||||
109 | } never executed: end of block | 0 | ||||||||||||
110 | - | |||||||||||||
111 | ReturnedValue MapPrototype::method_clear(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||
112 | { | - | ||||||||||||
113 | Scope scope(b); | - | ||||||||||||
114 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
115 | if (!that
| 36 | ||||||||||||
116 | return executed 36 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 36 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 36 | ||||||||||||
117 | - | |||||||||||||
118 | that->d()->esTable->clear(); | - | ||||||||||||
119 | return executed 36 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 36 times by 1 test: return Encode::undefined(); Executed by:
| 36 | ||||||||||||
120 | } | - | ||||||||||||
121 | - | |||||||||||||
122 | ReturnedValue MapPrototype::method_delete(const FunctionObject *b, const Value *thisObject, const Value *argv, int) | - | ||||||||||||
123 | { | - | ||||||||||||
124 | Scope scope(b); | - | ||||||||||||
125 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
126 | if (!that
| 36-60 | ||||||||||||
127 | return executed 36 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 36 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 36 | ||||||||||||
128 | - | |||||||||||||
129 | return executed 60 times by 1 test: Encode(that->d()->esTable->remove(argv[0]));return Encode(that->d()->esTable->remove(argv[0])); Executed by:
executed 60 times by 1 test: return Encode(that->d()->esTable->remove(argv[0])); Executed by:
| 60 | ||||||||||||
130 | } | - | ||||||||||||
131 | - | |||||||||||||
132 | ReturnedValue MapPrototype::method_entries(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||
133 | { | - | ||||||||||||
134 | Scope scope(b); | - | ||||||||||||
135 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
136 | if (!that
| 52-92 | ||||||||||||
137 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
138 | - | |||||||||||||
139 | Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that)); | - | ||||||||||||
140 | ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind; | - | ||||||||||||
141 | return executed 92 times by 1 test: ao->asReturnedValue();return ao->asReturnedValue(); Executed by:
executed 92 times by 1 test: return ao->asReturnedValue(); Executed by:
| 92 | ||||||||||||
142 | } | - | ||||||||||||
143 | - | |||||||||||||
144 | ReturnedValue MapPrototype::method_forEach(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||
145 | { | - | ||||||||||||
146 | Scope scope(b); | - | ||||||||||||
147 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
148 | if (!that
| 52-66 | ||||||||||||
149 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
150 | - | |||||||||||||
151 | ScopedFunctionObject callbackfn(scope, argv[0]); | - | ||||||||||||
152 | if (!callbackfn
| 28-38 | ||||||||||||
153 | return executed 28 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 28 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 28 | ||||||||||||
154 | - | |||||||||||||
155 | ScopedValue thisArg(scope, Primitive::undefinedValue()); | - | ||||||||||||
156 | if (argc > 1
| 4-34 | ||||||||||||
157 | thisArg = ScopedValue(scope, argv[1]); executed 4 times by 1 test: thisArg = ScopedValue(scope, argv[1]); Executed by:
| 4 | ||||||||||||
158 | - | |||||||||||||
159 | Value *arguments = scope.alloc(3); | - | ||||||||||||
160 | for (uint i = 0; i < that->d()->esTable->size()
| 38-68 | ||||||||||||
161 | that->d()->esTable->iterate(i, &arguments[0], &arguments[1]); | - | ||||||||||||
162 | - | |||||||||||||
163 | arguments[2] = that; | - | ||||||||||||
164 | callbackfn->call(thisArg, arguments, 3); | - | ||||||||||||
165 | do { if (scope.hasException()
never executed: QV4::Encode::undefined();return QV4::Encode::undefined(); never executed: } } while (false);return QV4::Encode::undefined(); | 0-68 | ||||||||||||
166 | } executed 68 times by 1 test: end of block Executed by:
| 68 | ||||||||||||
167 | return executed 38 times by 1 test: Encode::undefined();return Encode::undefined(); Executed by:
executed 38 times by 1 test: return Encode::undefined(); Executed by:
| 38 | ||||||||||||
168 | } | - | ||||||||||||
169 | - | |||||||||||||
170 | ReturnedValue MapPrototype::method_get(const FunctionObject *b, const Value *thisObject, const Value *argv, int) | - | ||||||||||||
171 | { | - | ||||||||||||
172 | Scope scope(b); | - | ||||||||||||
173 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
174 | if (!that
| 52-76 | ||||||||||||
175 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
176 | - | |||||||||||||
177 | return executed 76 times by 1 test: that->d()->esTable->get(argv[0]);return that->d()->esTable->get(argv[0]); Executed by:
executed 76 times by 1 test: return that->d()->esTable->get(argv[0]); Executed by:
| 76 | ||||||||||||
178 | } | - | ||||||||||||
179 | - | |||||||||||||
180 | ReturnedValue MapPrototype::method_has(const FunctionObject *b, const Value *thisObject, const Value *argv, int) | - | ||||||||||||
181 | { | - | ||||||||||||
182 | Scope scope(b); | - | ||||||||||||
183 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
184 | if (!that
| 52-108 | ||||||||||||
185 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
186 | - | |||||||||||||
187 | return executed 108 times by 1 test: Encode(that->d()->esTable->has(argv[0]));return Encode(that->d()->esTable->has(argv[0])); Executed by:
executed 108 times by 1 test: return Encode(that->d()->esTable->has(argv[0])); Executed by:
| 108 | ||||||||||||
188 | } | - | ||||||||||||
189 | - | |||||||||||||
190 | ReturnedValue MapPrototype::method_keys(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||
191 | { | - | ||||||||||||
192 | Scope scope(b); | - | ||||||||||||
193 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
194 | if (!that
| 20-52 | ||||||||||||
195 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
196 | - | |||||||||||||
197 | Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that)); | - | ||||||||||||
198 | ao->d()->iterationKind = IteratorKind::KeyIteratorKind; | - | ||||||||||||
199 | return executed 20 times by 1 test: ao->asReturnedValue();return ao->asReturnedValue(); Executed by:
executed 20 times by 1 test: return ao->asReturnedValue(); Executed by:
| 20 | ||||||||||||
200 | } | - | ||||||||||||
201 | - | |||||||||||||
202 | ReturnedValue MapPrototype::method_set(const FunctionObject *b, const Value *thisObject, const Value *argv, int) | - | ||||||||||||
203 | { | - | ||||||||||||
204 | Scope scope(b); | - | ||||||||||||
205 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
206 | if (!that
| 52-419 | ||||||||||||
207 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
208 | - | |||||||||||||
209 | that->d()->esTable->set(argv[0], argv[1]); | - | ||||||||||||
210 | return executed 419 times by 1 test: that.asReturnedValue();return that.asReturnedValue(); Executed by:
executed 419 times by 1 test: return that.asReturnedValue(); Executed by:
| 419 | ||||||||||||
211 | } | - | ||||||||||||
212 | - | |||||||||||||
213 | ReturnedValue MapPrototype::method_get_size(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||
214 | { | - | ||||||||||||
215 | Scope scope(b); | - | ||||||||||||
216 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
217 | if (!that
| 36-99 | ||||||||||||
218 | return executed 36 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 36 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 36 | ||||||||||||
219 | - | |||||||||||||
220 | return executed 99 times by 1 test: Encode(that->d()->esTable->size());return Encode(that->d()->esTable->size()); Executed by:
executed 99 times by 1 test: return Encode(that->d()->esTable->size()); Executed by:
| 99 | ||||||||||||
221 | } | - | ||||||||||||
222 | - | |||||||||||||
223 | ReturnedValue MapPrototype::method_values(const FunctionObject *b, const Value *thisObject, const Value *, int) | - | ||||||||||||
224 | { | - | ||||||||||||
225 | Scope scope(b); | - | ||||||||||||
226 | Scoped<MapObject> that(scope, thisObject); | - | ||||||||||||
227 | if (!that
| 28-52 | ||||||||||||
228 | return executed 52 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError(); Executed by:
executed 52 times by 1 test: return scope.engine->throwTypeError(); Executed by:
| 52 | ||||||||||||
229 | - | |||||||||||||
230 | Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that)); | - | ||||||||||||
231 | ao->d()->iterationKind = IteratorKind::ValueIteratorKind; | - | ||||||||||||
232 | return executed 28 times by 1 test: ao->asReturnedValue();return ao->asReturnedValue(); Executed by:
executed 28 times by 1 test: return ao->asReturnedValue(); Executed by:
| 28 | ||||||||||||
233 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |