OpenCoverage

qv4setobject.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4setobject.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-
41#include "qv4setobject_p.h"-
42#include "qv4setiterator_p.h"-
43#include "qv4estable_p.h"-
44#include "qv4symbol_p.h"-
45-
46using namespace QV4;-
47-
48DEFINE_OBJECT_VTABLE(SetCtor);-
49DEFINE_OBJECT_VTABLE(SetObject);-
50-
51void Heap::SetCtor::init(QV4::ExecutionContext *scope)-
52{-
53 Heap::FunctionObject::init(scope, QStringLiteral("Set"));
executed 98162 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
  • ...
98162
54}
executed 98439 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
  • ...
98439
55-
56ReturnedValue SetCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *)-
57{-
58 Scope scope(f);-
59 Scoped<SetObject> a(scope, scope.engine->memoryManager->allocate<SetObject>());-
60-
61 if (argc > 0) {
argc > 0Description
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 535 times by 1 test
Evaluated by:
  • tst_ecmascripttests
160-535
62 ScopedValue iterable(scope, argv[0]);-
63 if (!iterable->isUndefined() && !iterable->isNull()) {
!iterable->isUndefined()Description
TRUEevaluated 155 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!iterable->isNull()Description
TRUEevaluated 152 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-155
64 ScopedFunctionObject adder(scope, a->get(ScopedString(scope, scope.engine->newString(QString::fromLatin1("add")))));-
65 if (!adder)
!adderDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 145 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-145
66 return scope.engine->throwTypeError();
executed 8 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
8
67 ScopedObject iter(scope, Runtime::method_getIterator(scope.engine, iterable, true));-
68 CHECK_EXCEPTION();
never executed: return QV4::Encode::undefined();
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 148 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-148
69 if (!iter)
!iterDescription
TRUEnever evaluated
FALSEevaluated 146 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-146
70 return a.asReturnedValue();
never executed: return a.asReturnedValue();
0
71-
72 Value *nextValue = scope.alloc(1);-
73 ScopedValue done(scope);-
74 forever {-
75 done = Runtime::method_iteratorNext(scope.engine, iter, nextValue);-
76 CHECK_EXCEPTION();
executed 8 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
scope.hasException()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 374 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-374
77 if (done->toBoolean())
done->toBoolean()Description
TRUEevaluated 136 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 238 times by 1 test
Evaluated by:
  • tst_ecmascripttests
136-238
78 return a.asReturnedValue();
executed 136 times by 1 test: return a.asReturnedValue();
Executed by:
  • tst_ecmascripttests
136
79-
80 adder->call(a, nextValue, 1);-
81 if (scope.engine->hasException) {
scope.engine->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 234 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-234
82 ScopedValue falsey(scope, Encode(false));-
83 return Runtime::method_iteratorClose(scope.engine, iter, falsey);
executed 4 times by 1 test: return Runtime::method_iteratorClose(scope.engine, iter, falsey);
Executed by:
  • tst_ecmascripttests
4
84 }-
85 }
executed 234 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
234
86 }
never executed: end of block
0
87 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
8
88-
89 return a.asReturnedValue();
executed 543 times by 1 test: return a.asReturnedValue();
Executed by:
  • tst_ecmascripttests
543
90}-
91-
92ReturnedValue SetCtor::virtualCall(const FunctionObject *f, const Value *, const Value *, int)-
93{-
94 Scope scope(f);-
95 return scope.engine->throwTypeError(QString::fromLatin1("Set requires new"));
executed 8 times by 1 test: return scope.engine->throwTypeError(QString::fromLatin1("Set requires new"));
Executed by:
  • tst_ecmascripttests
8
96}-
97-
98void SetPrototype::init(ExecutionEngine *engine, Object *ctor)-
99{-
100 Scope scope(engine);-
101 ScopedObject o(scope);-
102 ctor->defineReadonlyConfigurableProperty(engine->id_length(), Primitive::fromInt32(0));-
103 ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));-
104 ctor->addSymbolSpecies();-
105 defineDefaultProperty(engine->id_constructor(), (o = ctor));-
106-
107 defineDefaultProperty(QStringLiteral("add"), method_add, 1);
executed 98653 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
  • ...
98653
108 defineDefaultProperty(QStringLiteral("clear"), method_clear, 0);
executed 98928 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
  • ...
98928
109 defineDefaultProperty(QStringLiteral("delete"), method_delete, 1);
executed 98951 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
  • ...
98951
110 defineDefaultProperty(QStringLiteral("entries"), method_entries, 0);
executed 98572 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
  • ...
98572
111 defineDefaultProperty(QStringLiteral("forEach"), method_forEach, 1);
executed 98823 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
  • ...
98823
112 defineDefaultProperty(QStringLiteral("has"), method_has, 1);
executed 98988 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
  • ...
98988
113 defineAccessorProperty(QStringLiteral("size"), method_get_size, nullptr);
executed 98953 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
  • ...
98953
114-
115 // Per the spec, the value for 'keys' is the same as 'values'.-
116 ScopedString valString(scope, scope.engine->newIdentifier(QStringLiteral("values")));
executed 98848 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
  • ...
98848
117 ScopedFunctionObject valuesFn(scope, FunctionObject::createBuiltinFunction(engine, valString, SetPrototype::method_values, 0));-
118 defineDefaultProperty(QStringLiteral("keys"), valuesFn);
executed 98738 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
  • ...
98738
119 defineDefaultProperty(QStringLiteral("values"), valuesFn);
executed 98582 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
  • ...
98582
120-
121 defineDefaultProperty(engine->symbol_iterator(), valuesFn);-
122-
123 ScopedString val(scope, engine->newString(QLatin1String("Set")));-
124 defineReadonlyConfigurableProperty(engine->symbol_toStringTag(), val);-
125}
executed 99003 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
  • ...
99003
126-
127void Heap::SetObject::init()-
128{-
129 Object::init();-
130 esTable = new ESTable();-
131}
executed 695 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
695
132-
133void Heap::SetObject::destroy()-
134{-
135 delete esTable;-
136 esTable = 0;-
137}
executed 704 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
704
138-
139void Heap::SetObject::markObjects(Heap::Base *that, MarkStack *markStack)-
140{-
141 SetObject *s = static_cast<SetObject *>(that);-
142 s->esTable->markObjects(markStack);-
143 Object::markObjects(that, markStack);-
144}
never executed: end of block
0
145-
146ReturnedValue SetPrototype::method_add(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
147{-
148 Scope scope(b);-
149 Scoped<SetObject> that(scope, thisObject);-
150 if (!that)
!thatDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 527 times by 1 test
Evaluated by:
  • tst_ecmascripttests
80-527
151 return scope.engine->throwTypeError();
executed 80 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
80
152-
153 that->d()->esTable->set(argv[0], Primitive::undefinedValue());-
154 return that.asReturnedValue();
executed 529 times by 1 test: return that.asReturnedValue();
Executed by:
  • tst_ecmascripttests
529
155}-
156-
157ReturnedValue SetPrototype::method_clear(const FunctionObject *b, const Value *thisObject, const Value *, int)-
158{-
159 Scope scope(b);-
160 Scoped<SetObject> that(scope, thisObject);-
161 if (!that)
!thatDescription
TRUEevaluated 79 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-79
162 return scope.engine->throwTypeError();
executed 79 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
79
163-
164 that->d()->esTable->clear();-
165 return Encode::undefined();
executed 16 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
16
166}-
167-
168ReturnedValue SetPrototype::method_delete(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
169{-
170 Scope scope(b);-
171 Scoped<SetObject> that(scope, thisObject);-
172 if (!that)
!thatDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_ecmascripttests
55-80
173 return scope.engine->throwTypeError();
executed 80 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
80
174-
175 return Encode(that->d()->esTable->remove(argv[0]));
executed 55 times by 1 test: return Encode(that->d()->esTable->remove(argv[0]));
Executed by:
  • tst_ecmascripttests
55
176}-
177-
178ReturnedValue SetPrototype::method_entries(const FunctionObject *b, const Value *thisObject, const Value *, int)-
179{-
180 Scope scope(b);-
181 Scoped<SetObject> that(scope, thisObject);-
182 if (!that)
!thatDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
20-80
183 return scope.engine->throwTypeError();
executed 80 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
80
184-
185 Scoped<SetIteratorObject> ao(scope, scope.engine->newSetIteratorObject(that));-
186 ao->d()->iterationKind = IteratorKind::KeyValueIteratorKind;-
187 return ao->asReturnedValue();
executed 20 times by 1 test: return ao->asReturnedValue();
Executed by:
  • tst_ecmascripttests
20
188}-
189-
190ReturnedValue SetPrototype::method_forEach(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)-
191{-
192 Scope scope(b);-
193 Scoped<SetObject> that(scope, thisObject);-
194 if (!that)
!thatDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_ecmascripttests
72-80
195 return scope.engine->throwTypeError();
executed 80 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
80
196-
197 ScopedFunctionObject callbackfn(scope, argv[0]);-
198 if (!callbackfn)
!callbackfnDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
24-48
199 return scope.engine->throwTypeError();
executed 24 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
24
200-
201 ScopedValue thisArg(scope, Primitive::undefinedValue());-
202 if (argc > 1)
argc > 1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-40
203 thisArg = ScopedValue(scope, argv[1]);
executed 8 times by 1 test: thisArg = ScopedValue(scope, argv[1]);
Executed by:
  • tst_ecmascripttests
8
204-
205 Value *arguments = scope.alloc(3);-
206 for (uint i = 0; i < that->d()->esTable->size(); ++i) {
i < that->d()->esTable->size()Description
TRUEevaluated 96 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
40-96
207 that->d()->esTable->iterate(i, &arguments[0], &arguments[1]); // fill in key (0), value (1)-
208 arguments[1] = arguments[0]; // but for set, we want to return the key twice; value is always undefined.-
209-
210 arguments[2] = that;-
211 callbackfn->call(thisArg, arguments, 3);-
212 CHECK_EXCEPTION();
executed 8 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
scope.hasException()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 88 times by 1 test
Evaluated by:
  • tst_ecmascripttests
8-88
213 }
executed 88 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
88
214 return Encode::undefined();
executed 40 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
40
215}-
216-
217ReturnedValue SetPrototype::method_has(const FunctionObject *b, const Value *thisObject, const Value *argv, int)-
218{-
219 Scope scope(b);-
220 Scoped<SetObject> that(scope, thisObject);-
221 if (!that)
!thatDescription
TRUEevaluated 77 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 91 times by 1 test
Evaluated by:
  • tst_ecmascripttests
77-91
222 return scope.engine->throwTypeError();
executed 77 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
77
223-
224 return Encode(that->d()->esTable->has(argv[0]));
executed 91 times by 1 test: return Encode(that->d()->esTable->has(argv[0]));
Executed by:
  • tst_ecmascripttests
91
225}-
226-
227ReturnedValue SetPrototype::method_get_size(const FunctionObject *b, const Value *thisObject, const Value *, int)-
228{-
229 Scope scope(b);-
230 Scoped<SetObject> that(scope, thisObject);-
231 if (!that)
!thatDescription
TRUEnever evaluated
FALSEevaluated 131 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-131
232 return scope.engine->throwTypeError();
never executed: return scope.engine->throwTypeError();
0
233-
234 return Encode(that->d()->esTable->size());
executed 131 times by 1 test: return Encode(that->d()->esTable->size());
Executed by:
  • tst_ecmascripttests
131
235}-
236-
237ReturnedValue SetPrototype::method_values(const FunctionObject *b, const Value *thisObject, const Value *, int)-
238{-
239 Scope scope(b);-
240 Scoped<SetObject> that(scope, thisObject);-
241 if (!that)
!thatDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 106 times by 1 test
Evaluated by:
  • tst_ecmascripttests
80-106
242 return scope.engine->throwTypeError();
executed 80 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
80
243-
244 Scoped<SetIteratorObject> ao(scope, scope.engine->newSetIteratorObject(that));-
245 ao->d()->iterationKind = IteratorKind::ValueIteratorKind;-
246 return ao->asReturnedValue();
executed 107 times by 1 test: return ao->asReturnedValue();
Executed by:
  • tst_ecmascripttests
107
247}-
248-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0