OpenCoverage

qv4mapobject.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4mapobject.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2018 Crimson AS <info@crimson.no>-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qv4setobject_p.h" // ### temporary-
41#include "qv4mapobject_p.h"-
42#include "qv4mapiterator_p.h"-
43#include "qv4estable_p.h"-
44#include "qv4symbol_p.h"-
45-
46using namespace QV4;-
47-
48DEFINE_OBJECT_VTABLE(MapCtor);-
49DEFINE_OBJECT_VTABLE(MapObject);-
50-
51void Heap::MapCtor::init(QV4::ExecutionContext *scope)-
52{-
53 Heap::FunctionObject::init(scope, QStringLiteral("Map"));
executed 98564 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98564
54}
executed 98827 times by 153 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98827
55-
56ReturnedValue MapCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *)-
57{-
58 Scope scope(f);-
59 Scoped<MapObject> a(scope, scope.engine->memoryManager->allocate<MapObject>());-
60-
61 if (argc > 0) {
argc > 0Description
TRUEevaluated 146 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 346 times by 1 test
Evaluated by:
  • tst_ecmascripttests
146-346
62 ScopedValue iterable(scope, argv[0]);-
63-
64 // ### beware, hack alert!-
65 // Object iteration seems broken right now. if we allow any object to-
66 // iterate, it endlessly loops in the Map/prototype tests in test262...-
67 // disable these for now until Object iteration is fixed, just so we can-
68 // test this.-
69 Scoped<MapObject> mapObjectCheck(scope, argv[0]);-
70 Scoped<SetObject> setObjectCheck(scope, argv[0]);-
71-
72 if (!iterable->isUndefined() && !iterable->isNull() && (mapObjectCheck || setObjectCheck)) {
!iterable->isUndefined()Description
TRUEevaluated 142 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!iterable->isNull()Description
TRUEevaluated 138 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-142
73 ScopedFunctionObject adder(scope, a->get(ScopedString(scope, scope.engine->newString(QString::fromLatin1("set")))));-
74 if (!adder)
!adderDescription
TRUEnever evaluated
FALSEnever evaluated
0
75 return scope.engine->throwTypeError();
never executed: return scope.engine->throwTypeError();
0
76 ScopedObject iter(scope, Runtime::method_getIterator(scope.engine, iterable, true));-
77-
78 CHECK_EXCEPTION();
never executed: return QV4::Encode::undefined();
scope.hasException()Description
TRUEnever evaluated
FALSEnever evaluated
0
79 if (!iter)
!iterDescription
TRUEnever evaluated
FALSEnever evaluated
0
80 return a.asReturnedValue();
never executed: return a.asReturnedValue();
0
81-
82 Value *nextValue = scope.alloc(1);-
83 ScopedValue done(scope);-
84 forever {-
85 done = Runtime::method_iteratorNext(scope.engine, iter, nextValue);-
86 CHECK_EXCEPTION();
never executed: return QV4::Encode::undefined();
scope.hasException()Description
TRUEnever evaluated
FALSEnever evaluated
0
87 if (done->toBoolean())
done->toBoolean()Description
TRUEnever evaluated
FALSEnever evaluated
0
88 return a.asReturnedValue();
never executed: return a.asReturnedValue();
0
89-
90 adder->call(a, nextValue, 1);-
91 if (scope.engine->hasException) {
scope.engine->hasExceptionDescription
TRUEnever evaluated
FALSEnever evaluated
0
92 ScopedValue falsey(scope, Encode(false));-
93 return Runtime::method_iteratorClose(scope.engine, iter, falsey);
never executed: return Runtime::method_iteratorClose(scope.engine, iter, falsey);
0
94 }-
95 }
never executed: end of block
0
96 }
never executed: end of block
0
97 }
executed 146 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
146
98 return a.asReturnedValue();
executed 492 times by 1 test: return a.asReturnedValue();
Executed by:
  • tst_ecmascripttests
492
99}-
100-
101ReturnedValue MapCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int)-
102{-
103 Scope scope(f);-
104 return scope.engine->throwTypeError(QString::fromLatin1("Map requires new"));
executed 8 times by 1 test: return scope.engine->throwTypeError(QString::fromLatin1("Map requires new"));
Executed by:
  • tst_ecmascripttests
8
105}-
106-
107void MapPrototype::init(ExecutionEngine *engine, Object *ctor)-
108{-
109 Scope scope(engine);-
110 ScopedObject o(scope);-
111 ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0));-
112 ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));-
113 ctor->addSymbolSpecies();-
114 defineDefaultProperty(engine->id_constructor(), (o = ctor));-
115-
116 defineDefaultProperty(QStringLiteral("clear"), method_clear, 0);
executed 98918 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98918
117 defineDefaultProperty(QStringLiteral("delete"), method_delete, 1);
executed 99001 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
99001
118 defineDefaultProperty(QStringLiteral("forEach"), method_forEach, 1);
executed 99100 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
99100
119 defineDefaultProperty(QStringLiteral("get"), method_get, 1);
executed 98591 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98591
120 defineDefaultProperty(QStringLiteral("has"), method_has, 1);
executed 98947 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98947
121 defineDefaultProperty(QStringLiteral("keys"), method_keys, 0);
executed 98979 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98979
122 defineDefaultProperty(QStringLiteral("set"), method_set, 0);
executed 98922 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98922
123 defineAccessorProperty(QStringLiteral("size"), method_get_size, nullptr);
executed 98956 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98956
124 defineDefaultProperty(QStringLiteral("values"), method_values, 0);
executed 98569 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98569
125-
126 // Per the spec, the value for entries/@@iterator is the same-
127 ScopedString valString(scope, scope.engine->newIdentifier(QStringLiteral("entries")));
executed 98859 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98859
128 ScopedFunctionObject entriesFn(scope, FunctionObject::createBuiltinFunction(engine, valString, MapPrototype::method_entries, 0));-
129 defineDefaultProperty(QStringLiteral("entries"), entriesFn);
executed 98760 times by 153 tests: return qstring_literal_temp;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
98760
130 defineDefaultProperty(engine->symbol_iterator(), entriesFn);-
131-
132 ScopedString val(scope, engine->newString(QLatin1String("Map")));-
133 defineReadonlyConfigurableProperty(engine->symbol_toStringTag(), val);-
134}
executed 99047 times by 153 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_ecmascripttests
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • ...
99047
135-
136void Heap::MapObject::init()-
137{-
138 Object::init();-
139 esTable = new ESTable();-
140}
executed 492 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
492
141-
142void Heap::MapObject::destroy()-
143{-
144 delete esTable;-
145 esTable = 0;-
146}
executed 494 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
494
147-
148void Heap::MapObject::markObjects(Heap::Base *that, MarkStack *markStack)-
149{-
150 MapObject *m = static_cast<MapObject *>(that);-
151 m->esTable->markObjects(markStack);-
152 Object::markObjects(that, markStack);-
153}
never executed: end of block
0
154-
155ReturnedValue MapPrototype::method_clear(const FunctionObject *b, const Value *thisObject, const Value *, int)-
156{-
157 Scope scope(b);-
158 Scoped<MapObject> that(scope, thisObject);-
159 if (!that)
!thatDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
36
160 return scope.engine->throwTypeError();
executed 36 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
36
161-
162 that->d()->esTable->clear();-
163 return Encode::undefined();
executed 36 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
36
164}-
165-
166ReturnedValue MapPrototype::method_delete(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
167{-
168 Scope scope(b);-
169 Scoped<MapObject> that(scope, thisObject);-
170 if (!that)
!thatDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_ecmascripttests
36-60
171 return scope.engine->throwTypeError();
executed 36 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
36
172-
173 return Encode(that->d()->esTable->remove(argv[0]));
executed 60 times by 1 test: return Encode(that->d()->esTable->remove(argv[0]));
Executed by:
  • tst_ecmascripttests
60
174}-
175-
176ReturnedValue MapPrototype::method_entries(const FunctionObject *b, const Value *thisObject, const Value *, int)-
177{-
178 Scope scope(b);-
179 Scoped<MapObject> that(scope, thisObject);-
180 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_ecmascripttests
52-92
181 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
182-
183 Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that));-
184 ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind;-
185 return ao->asReturnedValue();
executed 92 times by 1 test: return ao->asReturnedValue();
Executed by:
  • tst_ecmascripttests
92
186}-
187-
188ReturnedValue MapPrototype::method_forEach(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)-
189{-
190 Scope scope(b);-
191 Scoped<MapObject> that(scope, thisObject);-
192 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_ecmascripttests
52-66
193 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
194-
195 ScopedFunctionObject callbackfn(scope, argv[0]);-
196 if (!callbackfn)
!callbackfnDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_ecmascripttests
28-38
197 return scope.engine->throwTypeError();
executed 28 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
28
198-
199 ScopedValue thisArg(scope, Primitive::undefinedValue());-
200 if (argc > 1)
argc > 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-34
201 thisArg = ScopedValue(scope, argv[1]);
executed 4 times by 1 test: thisArg = ScopedValue(scope, argv[1]);
Executed by:
  • tst_ecmascripttests
4
202-
203 Value *arguments = scope.alloc(3);-
204 for (uint i = 0; i < that->d()->esTable->size(); ++i) {
i < that->d()->esTable->size()Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_ecmascripttests
38-68
205 that->d()->esTable->iterate(i, &arguments[0], &arguments[1]); // fill in key (0), value (1)-
206-
207 arguments[2] = that;-
208 callbackfn->call(thisArg, arguments, 3);-
209 CHECK_EXCEPTION();
never executed: return QV4::Encode::undefined();
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-68
210 }
executed 68 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
68
211 return Encode::undefined();
executed 38 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
38
212}-
213-
214ReturnedValue MapPrototype::method_get(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
215{-
216 Scope scope(b);-
217 Scoped<MapObject> that(scope, thisObject);-
218 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_ecmascripttests
52-76
219 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
220-
221 return that->d()->esTable->get(argv[0]);
executed 76 times by 1 test: return that->d()->esTable->get(argv[0]);
Executed by:
  • tst_ecmascripttests
76
222}-
223-
224ReturnedValue MapPrototype::method_has(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
225{-
226 Scope scope(b);-
227 Scoped<MapObject> that(scope, thisObject);-
228 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 108 times by 1 test
Evaluated by:
  • tst_ecmascripttests
52-108
229 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
230-
231 return Encode(that->d()->esTable->has(argv[0]));
executed 108 times by 1 test: return Encode(that->d()->esTable->has(argv[0]));
Executed by:
  • tst_ecmascripttests
108
232}-
233-
234ReturnedValue MapPrototype::method_keys(const FunctionObject *b, const Value *thisObject, const Value *, int)-
235{-
236 Scope scope(b);-
237 Scoped<MapObject> that(scope, thisObject);-
238 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
20-52
239 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
240-
241 Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that));-
242 ao->d()->iterationKind = IteratorKind::KeyIteratorKind;-
243 return ao->asReturnedValue();
executed 20 times by 1 test: return ao->asReturnedValue();
Executed by:
  • tst_ecmascripttests
20
244}-
245-
246ReturnedValue MapPrototype::method_set(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
247{-
248 Scope scope(b);-
249 Scoped<MapObject> that(scope, thisObject);-
250 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 419 times by 1 test
Evaluated by:
  • tst_ecmascripttests
52-419
251 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
252-
253 that->d()->esTable->set(argv[0], argv[1]);-
254 return that.asReturnedValue();
executed 419 times by 1 test: return that.asReturnedValue();
Executed by:
  • tst_ecmascripttests
419
255}-
256-
257ReturnedValue MapPrototype::method_get_size(const FunctionObject *b, const Value *thisObject, const Value *, int)-
258{-
259 Scope scope(b);-
260 Scoped<MapObject> that(scope, thisObject);-
261 if (!that)
!thatDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 99 times by 1 test
Evaluated by:
  • tst_ecmascripttests
36-99
262 return scope.engine->throwTypeError();
executed 36 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
36
263-
264 return Encode(that->d()->esTable->size());
executed 99 times by 1 test: return Encode(that->d()->esTable->size());
Executed by:
  • tst_ecmascripttests
99
265}-
266-
267ReturnedValue MapPrototype::method_values(const FunctionObject *b, const Value *thisObject, const Value *, int)-
268{-
269 Scope scope(b);-
270 Scoped<MapObject> that(scope, thisObject);-
271 if (!that)
!thatDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
28-52
272 return scope.engine->throwTypeError();
executed 52 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
52
273-
274 Scoped<MapIteratorObject> ao(scope, scope.engine->newMapIteratorObject(that));-
275 ao->d()->iterationKind = IteratorKind::ValueIteratorKind;-
276 return ao->asReturnedValue();
executed 28 times by 1 test: return ao->asReturnedValue();
Executed by:
  • tst_ecmascripttests
28
277}-
278-
279-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0