OpenCoverage

qv4reflect.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4reflect.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2018 The Qt Company Ltd.-
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 "qv4reflect_p.h"-
41#include "qv4symbol_p.h"-
42#include "qv4runtimeapi_p.h"-
43#include "qv4objectproto_p.h"-
44#include "qv4propertykey_p.h"-
45-
46using namespace QV4;-
47-
48DEFINE_OBJECT_VTABLE(Reflect);-
49-
50void Heap::Reflect::init()-
51{-
52 Object::init();-
53 Scope scope(internalClass->engine);-
54 ScopedObject r(scope, this);-
55-
56 r->defineDefaultProperty(QStringLiteral("apply"), QV4::Reflect::method_apply, 3);
executed 97863 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
  • ...
97863
57 r->defineDefaultProperty(QStringLiteral("construct"), QV4::Reflect::method_construct, 2);
executed 98489 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
  • ...
98489
58 r->defineDefaultProperty(QStringLiteral("defineProperty"), QV4::Reflect::method_defineProperty, 3);
executed 98386 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
  • ...
98386
59 r->defineDefaultProperty(QStringLiteral("deleteProperty"), QV4::Reflect::method_deleteProperty, 2);
executed 98460 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
  • ...
98460
60 r->defineDefaultProperty(QStringLiteral("get"), QV4::Reflect::method_get, 2);
executed 98628 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
  • ...
98628
61 r->defineDefaultProperty(QStringLiteral("getOwnPropertyDescriptor"), QV4::Reflect::method_getOwnPropertyDescriptor, 2);
executed 98454 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
  • ...
98454
62 r->defineDefaultProperty(QStringLiteral("getPrototypeOf"), QV4::Reflect::method_getPrototypeOf, 1);
executed 98677 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
  • ...
98677
63 r->defineDefaultProperty(QStringLiteral("has"), QV4::Reflect::method_has, 2);
executed 98814 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
  • ...
98814
64 r->defineDefaultProperty(QStringLiteral("isExtensible"), QV4::Reflect::method_isExtensible, 1);
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
65 r->defineDefaultProperty(QStringLiteral("ownKeys"), QV4::Reflect::method_ownKeys, 1);
executed 98529 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
  • ...
98529
66 r->defineDefaultProperty(QStringLiteral("preventExtensions"), QV4::Reflect::method_preventExtensions, 1);
executed 98612 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
  • ...
98612
67 r->defineDefaultProperty(QStringLiteral("set"), QV4::Reflect::method_set, 3);
executed 98838 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
  • ...
98838
68 r->defineDefaultProperty(QStringLiteral("setPrototypeOf"), QV4::Reflect::method_setPrototypeOf, 2);
executed 98611 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
  • ...
98611
69}
executed 99044 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
  • ...
99044
70-
71struct CallArgs {-
72 Value *argv;-
73 int argc;-
74};-
75-
76static CallArgs createListFromArrayLike(Scope &scope, const Object *o)-
77{-
78 int len = o->getLength();-
79 Value *arguments = scope.alloc(len);-
80-
81 for (int i = 0; i < len; ++i) {
i < lenDescription
TRUEevaluated 242 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 304 times by 1 test
Evaluated by:
  • tst_ecmascripttests
242-304
82 arguments[i] = o->get(i);-
83 if (scope.hasException())
scope.hasException()Description
TRUEnever evaluated
FALSEevaluated 243 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-243
84 return { nullptr, 0 };
never executed: return { nullptr, 0 };
0
85 }
executed 243 times by 1 test: end of block
Executed by:
  • tst_ecmascripttests
243
86 return { arguments, len };
executed 304 times by 1 test: return { arguments, len };
Executed by:
  • tst_ecmascripttests
304
87}-
88-
89ReturnedValue Reflect::method_apply(const FunctionObject *f, const Value *, const Value *argv, int argc)-
90{-
91 Scope scope(f);-
92 if (argc < 3 || !argv[0].isFunctionObject() || !argv[2].isObject())
argc < 3Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isFunctionObject()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[2].isObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-32
93 return scope.engine->throwTypeError();
executed 16 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
16
94-
95 const Object *o = static_cast<const Object *>(argv + 2);-
96 CallArgs arguments = createListFromArrayLike(scope, o);-
97 if (scope.hasException())
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-12
98 return Encode::undefined();
executed 4 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
4
99-
100 return static_cast<const FunctionObject &>(argv[0]).call(&argv[1], arguments.argv, arguments.argc);
executed 12 times by 1 test: return static_cast<const FunctionObject &>(argv[0]).call(&argv[1], arguments.argv, arguments.argc);
Executed by:
  • tst_ecmascripttests
12
101}-
102-
103ReturnedValue Reflect::method_construct(const FunctionObject *f, const Value *, const Value *argv, int argc)-
104{-
105 Scope scope(f);-
106 if (argc < 2 || !argv[0].isFunctionObject() || !argv[1].isObject())
argc < 2Description
TRUEnever evaluated
FALSEevaluated 320 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isFunctionObject()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 292 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[1].isObject()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 288 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-320
107 return scope.engine->throwTypeError();
executed 32 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
32
108-
109 const Object *o = static_cast<const Object *>(argv + 1);-
110 CallArgs arguments = createListFromArrayLike(scope, o);-
111 if (scope.hasException())
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 284 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-284
112 return Encode::undefined();
executed 4 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
4
113-
114 return static_cast<const FunctionObject &>(argv[0]).callAsConstructor(arguments.argv, arguments.argc);
executed 284 times by 1 test: return static_cast<const FunctionObject &>(argv[0]).callAsConstructor(arguments.argv, arguments.argc);
Executed by:
  • tst_ecmascripttests
284
115}-
116-
117ReturnedValue Reflect::method_defineProperty(const FunctionObject *f, const Value *, const Value *argv, int argc)-
118{-
119 Scope scope(f);-
120 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 1079 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1060 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-1079
121 return scope.engine->throwTypeError();
executed 20 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
122-
123 ScopedObject O(scope, argv[0]);-
124 ScopedPropertyKey name(scope, (argc > 1 ? argv[1] : Primitive::undefinedValue()).toPropertyKey(scope.engine));-
125 if (scope.engine->hasException)
scope.engine->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1055 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-1055
126 return QV4::Encode::undefined();
executed 4 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
4
127-
128 ScopedValue attributes(scope, argc > 2 ? argv[2] : Primitive::undefinedValue());-
129 ScopedProperty pd(scope);-
130 PropertyAttributes attrs;-
131 ObjectPrototype::toPropertyDescriptor(scope.engine, attributes, pd, &attrs);-
132 if (scope.engine->hasException)
scope.engine->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1051 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-1051
133 return QV4::Encode::undefined();
executed 4 times by 1 test: return QV4::Encode::undefined();
Executed by:
  • tst_ecmascripttests
4
134-
135 bool result = O->defineOwnProperty(name, pd, attrs);-
136-
137 return Encode(result);
executed 1052 times by 1 test: return Encode(result);
Executed by:
  • tst_ecmascripttests
1052
138}-
139-
140ReturnedValue Reflect::method_deleteProperty(const FunctionObject *f, const Value *, const Value *argv, int argc)-
141{-
142 ExecutionEngine *e = f->engine();-
143 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-64
144 return e->throwTypeError();
executed 20 times by 1 test: return e->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
145-
146 bool result = Runtime::method_deleteProperty(e, argv[0], argc > 1 ? argv[1] : Primitive::undefinedValue());-
147 return Encode(result);
executed 44 times by 1 test: return Encode(result);
Executed by:
  • tst_ecmascripttests
44
148}-
149-
150ReturnedValue Reflect::method_get(const FunctionObject *f, const Value *, const Value *argv, int argc)-
151{-
152 Scope scope(f);-
153 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-68
154 return scope.engine->throwTypeError();
executed 20 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
155-
156 ScopedObject o(scope, static_cast<const Object *>(argv));-
157 Value undef = Primitive::undefinedValue();-
158 const Value *index = argc > 1 ? &argv[1] : &undef;
argc > 1Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-48
159 ScopedPropertyKey name(scope, index->toPropertyKey(scope.engine));-
160 if (scope.hasException())
scope.hasException()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-44
161 return Encode::undefined();
executed 4 times by 1 test: return Encode::undefined();
Executed by:
  • tst_ecmascripttests
4
162 ScopedValue receiver(scope, argc > 2 ? argv[2] : *o);-
163-
164 return Encode(o->get(name, receiver));
executed 44 times by 1 test: return Encode(o->get(name, receiver));
Executed by:
  • tst_ecmascripttests
44
165}-
166-
167ReturnedValue Reflect::method_getOwnPropertyDescriptor(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)-
168{-
169 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 148 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 128 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-148
170 return f->engine()->throwTypeError();
executed 20 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
171-
172 return ObjectPrototype::method_getOwnPropertyDescriptor(f, thisObject, argv, argc);
executed 128 times by 1 test: return ObjectPrototype::method_getOwnPropertyDescriptor(f, thisObject, argv, argc);
Executed by:
  • tst_ecmascripttests
128
173}-
174-
175ReturnedValue Reflect::method_getPrototypeOf(const FunctionObject *f, const Value *, const Value *argv, int argc)-
176{-
177 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-36
178 return f->engine()->throwTypeError();
executed 20 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
179-
180 const Object *o = static_cast<const Object *>(argv);-
181 Heap::Object *p = o->getPrototypeOf();-
182 return (p ? p->asReturnedValue() : Encode::null());
executed 16 times by 1 test: return (p ? p->asReturnedValue() : Encode::null());
Executed by:
  • tst_ecmascripttests
16
183}-
184-
185ReturnedValue Reflect::method_has(const FunctionObject *f, const Value *, const Value *argv, int argc)-
186{-
187 Scope scope(f);-
188 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 1067 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1048 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-1067
189 return scope.engine->throwTypeError();
executed 20 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
190-
191 ScopedObject o(scope, static_cast<const Object *>(argv));-
192 Value undef = Primitive::undefinedValue();-
193 const Value *index = argc > 1 ? &argv[1] : &undef;
argc > 1Description
TRUEevaluated 1047 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-1047
194-
195 ScopedPropertyKey name(scope, index->toPropertyKey(scope.engine));-
196 if (scope.engine->hasException)
scope.engine->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 1044 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-1044
197 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
198-
199 bool hasProperty = false;-
200 (void) o->get(name, nullptr, &hasProperty);-
201 return Encode(hasProperty);
executed 1044 times by 1 test: return Encode(hasProperty);
Executed by:
  • tst_ecmascripttests
1044
202}-
203-
204ReturnedValue Reflect::method_isExtensible(const FunctionObject *f, const Value *, const Value *argv, int argc)-
205{-
206 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-52
207 return f->engine()->throwTypeError();
executed 40 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
40
208-
209 const Object *o = static_cast<const Object *>(argv);-
210 return Encode(o->isExtensible());
executed 12 times by 1 test: return Encode(o->isExtensible());
Executed by:
  • tst_ecmascripttests
12
211}-
212-
213-
214ReturnedValue Reflect::method_ownKeys(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)-
215{-
216 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-72
217 return f->engine()->throwTypeError();
executed 20 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
218-
219 return ObjectPrototype::method_getOwnPropertyNames(f, thisObject, argv, argc);
executed 52 times by 1 test: return ObjectPrototype::method_getOwnPropertyNames(f, thisObject, argv, argc);
Executed by:
  • tst_ecmascripttests
52
220}-
221-
222ReturnedValue Reflect::method_preventExtensions(const FunctionObject *f, const Value *, const Value *argv, int argc)-
223{-
224 Scope scope(f);-
225 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-44
226 return scope.engine->throwTypeError();
never executed: return scope.engine->throwTypeError();
0
227-
228 ScopedObject o(scope, static_cast<const Object *>(argv));-
229 return Encode(o->preventExtensions());
executed 44 times by 1 test: return Encode(o->preventExtensions());
Executed by:
  • tst_ecmascripttests
44
230}-
231-
232ReturnedValue Reflect::method_set(const FunctionObject *f, const Value *, const Value *argv, int argc)-
233{-
234 Scope scope(f);-
235 if (!argc || !argv[0].isObject())
!argcDescription
TRUEnever evaluated
FALSEevaluated 855 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 836 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-855
236 return scope.engine->throwTypeError();
executed 20 times by 1 test: return scope.engine->throwTypeError();
Executed by:
  • tst_ecmascripttests
20
237-
238 ScopedObject o(scope, static_cast<const Object *>(argv));-
239 Value undef = Primitive::undefinedValue();-
240 const Value *index = argc > 1 ? &argv[1] : &undef;
argc > 1Description
TRUEevaluated 835 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEnever evaluated
0-835
241 const Value &val = argc > 2 ? argv[2] : undef;
argc > 2Description
TRUEevaluated 831 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-831
242 ScopedValue receiver(scope, argc >3 ? argv[3] : argv[0]);-
243-
244 ScopedPropertyKey propertyKey(scope, index->toPropertyKey(scope.engine));-
245 if (scope.engine->hasException)
scope.engine->hasExceptionDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 831 times by 1 test
Evaluated by:
  • tst_ecmascripttests
4-831
246 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_ecmascripttests
4
247 bool result = o->put(propertyKey, val, receiver);-
248 return Encode(result);
executed 832 times by 1 test: return Encode(result);
Executed by:
  • tst_ecmascripttests
832
249}-
250-
251ReturnedValue Reflect::method_setPrototypeOf(const FunctionObject *f, const Value *, const Value *argv, int argc)-
252{-
253 if (argc < 2 || !argv[0].isObject() || (!argv[1].isNull() && !argv[1].isObject()))
argc < 2Description
TRUEnever evaluated
FALSEevaluated 180 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[0].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 160 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[1].isNull()Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
!argv[1].isObject()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_ecmascripttests
0-180
254 return f->engine()->throwTypeError();
executed 40 times by 1 test: return f->engine()->throwTypeError();
Executed by:
  • tst_ecmascripttests
40
255-
256 Scope scope(f);-
257 ScopedObject o(scope, static_cast<const Object *>(argv));-
258 const Object *proto = argv[1].isNull() ? nullptr : static_cast<const Object *>(argv + 1);
argv[1].isNull()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_ecmascripttests
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_ecmascripttests
16-124
259 return Encode(o->setPrototypeOf(proto));
executed 140 times by 1 test: return Encode(o->setPrototypeOf(proto));
Executed by:
  • tst_ecmascripttests
140
260}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0