| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4reflect.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | using namespace QV4; | - | ||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | const QV4::VTable Reflect::static_vtbl = { (std::is_same<Reflect::SuperClass, Object>::value) ? nullptr : &Reflect::SuperClass::static_vtbl, (sizeof(Reflect::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), (sizeof(Reflect::Data) + (Reflect::NInlineProperties*sizeof(QV4::Value)) + QV4::Chunk::SlotSize - 1)/QV4::Chunk::SlotSize*QV4::Chunk::SlotSize/sizeof(QV4::Value) - (sizeof(Reflect::Data) + sizeof(QV4::Value) - 1)/sizeof(QV4::Value), Reflect::IsExecutionContext, Reflect::IsString, Reflect::IsObject, Reflect::IsFunctionObject, Reflect::IsErrorObject, Reflect::IsArrayData, Reflect::IsStringOrSymbol, Reflect::MyType, { 0, 0, 0, 0 }, "Reflect", Reflect::virtualDestroy, Reflect::Data::markObjects, Reflect::virtualIsEqualTo, Reflect::virtualGet, Reflect::virtualPut, Reflect::virtualDeleteProperty, Reflect::virtualHasProperty, Reflect::virtualGetOwnProperty, Reflect::virtualDefineOwnProperty, Reflect::virtualIsExtensible, Reflect::virtualPreventExtensions, Reflect::virtualGetPrototypeOf, Reflect::virtualSetPrototypeOf, Reflect::virtualGetLength, Reflect::virtualAdvanceIterator, Reflect::virtualInstanceOf, Reflect::virtualCall, Reflect::virtualCallAsConstructor, }; | - | ||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | void Heap::Reflect::init() | - | ||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||
| 9 | Object::init(); | - | ||||||||||||||||||||||||
| 10 | Scope scope(internalClass->engine); | - | ||||||||||||||||||||||||
| 11 | ScopedObject r(scope, this); | - | ||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "apply")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "apply" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 97863 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 97863 times by 153 tests: }()), QV4::Reflect::method_apply, 3);return qstring_literal_temp;Executed by:
| 97863 | ||||||||||||||||||||||||
| 14 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "construct")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "construct" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98489 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98489 times by 153 tests: }()), QV4::Reflect::method_construct, 2);return qstring_literal_temp;Executed by:
| 98489 | ||||||||||||||||||||||||
| 15 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "defineProperty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "defineProperty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98386 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98386 times by 153 tests: }()), QV4::Reflect::method_defineProperty, 3);return qstring_literal_temp;Executed by:
| 98386 | ||||||||||||||||||||||||
| 16 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "deleteProperty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "deleteProperty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98460 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98460 times by 153 tests: }()), QV4::Reflect::method_deleteProperty, 2);return qstring_literal_temp;Executed by:
| 98460 | ||||||||||||||||||||||||
| 17 | r->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 98628 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98628 times by 153 tests: }()), QV4::Reflect::method_get, 2);return qstring_literal_temp;Executed by:
| 98628 | ||||||||||||||||||||||||
| 18 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "getOwnPropertyDescriptor")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "getOwnPropertyDescriptor" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98454 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98454 times by 153 tests: }()), QV4::Reflect::method_getOwnPropertyDescriptor, 2);return qstring_literal_temp;Executed by:
| 98454 | ||||||||||||||||||||||||
| 19 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "getPrototypeOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "getPrototypeOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98677 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98677 times by 153 tests: }()), QV4::Reflect::method_getPrototypeOf, 1);return qstring_literal_temp;Executed by:
| 98677 | ||||||||||||||||||||||||
| 20 | r->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 98814 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98814 times by 153 tests: }()), QV4::Reflect::method_has, 2);return qstring_literal_temp;Executed by:
| 98814 | ||||||||||||||||||||||||
| 21 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "isExtensible")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "isExtensible" }; 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: }()), QV4::Reflect::method_isExtensible, 1);return qstring_literal_temp;Executed by:
| 98760 | ||||||||||||||||||||||||
| 22 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "ownKeys")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ownKeys" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98529 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98529 times by 153 tests: }()), QV4::Reflect::method_ownKeys, 1);return qstring_literal_temp;Executed by:
| 98529 | ||||||||||||||||||||||||
| 23 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "preventExtensions")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "preventExtensions" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98612 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98612 times by 153 tests: }()), QV4::Reflect::method_preventExtensions, 1);return qstring_literal_temp;Executed by:
| 98612 | ||||||||||||||||||||||||
| 24 | r->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 98838 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98838 times by 153 tests: }()), QV4::Reflect::method_set, 3);return qstring_literal_temp;Executed by:
| 98838 | ||||||||||||||||||||||||
| 25 | r->defineDefaultProperty(([]() noexcept -> QString { enum { Size = sizeof(u"" "setPrototypeOf")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "setPrototypeOf" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 98611 times by 153 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 98611 times by 153 tests: }()), QV4::Reflect::method_setPrototypeOf, 2);return qstring_literal_temp;Executed by:
| 98611 | ||||||||||||||||||||||||
| 26 | } executed 99044 times by 153 tests: end of blockExecuted by:
| 99044 | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | struct CallArgs { | - | ||||||||||||||||||||||||
| 29 | Value *argv; | - | ||||||||||||||||||||||||
| 30 | int argc; | - | ||||||||||||||||||||||||
| 31 | }; | - | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | static CallArgs createListFromArrayLike(Scope &scope, const Object *o) | - | ||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||
| 35 | int len = o->getLength(); | - | ||||||||||||||||||||||||
| 36 | Value *arguments = scope.alloc(len); | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | for (int i = 0; i < len
| 242-304 | ||||||||||||||||||||||||
| 39 | arguments[i] = o->get(i); | - | ||||||||||||||||||||||||
| 40 | if (scope.hasException()
| 0-243 | ||||||||||||||||||||||||
| 41 | return never executed: { nullptr, 0 };return { nullptr, 0 };never executed: return { nullptr, 0 }; | 0 | ||||||||||||||||||||||||
| 42 | } executed 243 times by 1 test: end of blockExecuted by:
| 243 | ||||||||||||||||||||||||
| 43 | return executed 304 times by 1 test: { arguments, len };return { arguments, len };Executed by:
executed 304 times by 1 test: return { arguments, len };Executed by:
| 304 | ||||||||||||||||||||||||
| 44 | } | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | ReturnedValue Reflect::method_apply(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 47 | { | - | ||||||||||||||||||||||||
| 48 | Scope scope(f); | - | ||||||||||||||||||||||||
| 49 | if (argc < 3
| 0-32 | ||||||||||||||||||||||||
| 50 | return executed 16 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 16 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 16 | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | const Object *o = static_cast<const Object *>(argv + 2); | - | ||||||||||||||||||||||||
| 53 | CallArgs arguments = createListFromArrayLike(scope, o); | - | ||||||||||||||||||||||||
| 54 | if (scope.hasException()
| 4-12 | ||||||||||||||||||||||||
| 55 | return executed 4 times by 1 test: Encode::undefined();return Encode::undefined();Executed by:
executed 4 times by 1 test: return Encode::undefined();Executed by:
| 4 | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | return executed 12 times by 1 test: static_cast<const FunctionObject &>(argv[0]).call(&argv[1], arguments.argv, arguments.argc);return static_cast<const FunctionObject &>(argv[0]).call(&argv[1], arguments.argv, arguments.argc);Executed by:
executed 12 times by 1 test: return static_cast<const FunctionObject &>(argv[0]).call(&argv[1], arguments.argv, arguments.argc);Executed by:
| 12 | ||||||||||||||||||||||||
| 58 | } | - | ||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | ReturnedValue Reflect::method_construct(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||
| 62 | Scope scope(f); | - | ||||||||||||||||||||||||
| 63 | if (argc < 2
| 0-320 | ||||||||||||||||||||||||
| 64 | return executed 32 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 32 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 32 | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | const Object *o = static_cast<const Object *>(argv + 1); | - | ||||||||||||||||||||||||
| 67 | CallArgs arguments = createListFromArrayLike(scope, o); | - | ||||||||||||||||||||||||
| 68 | if (scope.hasException()
| 4-284 | ||||||||||||||||||||||||
| 69 | return executed 4 times by 1 test: Encode::undefined();return Encode::undefined();Executed by:
executed 4 times by 1 test: return Encode::undefined();Executed by:
| 4 | ||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | return executed 284 times by 1 test: static_cast<const FunctionObject &>(argv[0]).callAsConstructor(arguments.argv, arguments.argc);return static_cast<const FunctionObject &>(argv[0]).callAsConstructor(arguments.argv, arguments.argc);Executed by:
executed 284 times by 1 test: return static_cast<const FunctionObject &>(argv[0]).callAsConstructor(arguments.argv, arguments.argc);Executed by:
| 284 | ||||||||||||||||||||||||
| 72 | } | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | ReturnedValue Reflect::method_defineProperty(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 75 | { | - | ||||||||||||||||||||||||
| 76 | Scope scope(f); | - | ||||||||||||||||||||||||
| 77 | if (!argc
| 0-1079 | ||||||||||||||||||||||||
| 78 | return executed 20 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 20 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | ScopedObject O(scope, argv[0]); | - | ||||||||||||||||||||||||
| 81 | ScopedPropertyKey name(scope, (argc > 1 ? argv[1] : Primitive::undefinedValue()).toPropertyKey(scope.engine)); | - | ||||||||||||||||||||||||
| 82 | if (scope.engine->hasException
| 4-1055 | ||||||||||||||||||||||||
| 83 | return executed 4 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined();Executed by:
executed 4 times by 1 test: return QV4::Encode::undefined();Executed by:
| 4 | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | ScopedValue attributes(scope, argc > 2 ? argv[2] : Primitive::undefinedValue()); | - | ||||||||||||||||||||||||
| 86 | ScopedProperty pd(scope); | - | ||||||||||||||||||||||||
| 87 | PropertyAttributes attrs; | - | ||||||||||||||||||||||||
| 88 | ObjectPrototype::toPropertyDescriptor(scope.engine, attributes, pd, &attrs); | - | ||||||||||||||||||||||||
| 89 | if (scope.engine->hasException
| 4-1051 | ||||||||||||||||||||||||
| 90 | return executed 4 times by 1 test: QV4::Encode::undefined();return QV4::Encode::undefined();Executed by:
executed 4 times by 1 test: return QV4::Encode::undefined();Executed by:
| 4 | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | bool result = O->defineOwnProperty(name, pd, attrs); | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | return executed 1052 times by 1 test: Encode(result);return Encode(result);Executed by:
executed 1052 times by 1 test: return Encode(result);Executed by:
| 1052 | ||||||||||||||||||||||||
| 95 | } | - | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | ReturnedValue Reflect::method_deleteProperty(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 98 | { | - | ||||||||||||||||||||||||
| 99 | ExecutionEngine *e = f->engine(); | - | ||||||||||||||||||||||||
| 100 | if (!argc
| 0-64 | ||||||||||||||||||||||||
| 101 | return executed 20 times by 1 test: e->throwTypeError();return e->throwTypeError();Executed by:
executed 20 times by 1 test: return e->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | bool result = Runtime::method_deleteProperty(e, argv[0], argc > 1 ? argv[1] : Primitive::undefinedValue()); | - | ||||||||||||||||||||||||
| 104 | return executed 44 times by 1 test: Encode(result);return Encode(result);Executed by:
executed 44 times by 1 test: return Encode(result);Executed by:
| 44 | ||||||||||||||||||||||||
| 105 | } | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | ReturnedValue Reflect::method_get(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 108 | { | - | ||||||||||||||||||||||||
| 109 | Scope scope(f); | - | ||||||||||||||||||||||||
| 110 | if (!argc
| 0-68 | ||||||||||||||||||||||||
| 111 | return executed 20 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 20 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | ScopedObject o(scope, static_cast<const Object *>(argv)); | - | ||||||||||||||||||||||||
| 114 | Value undef = Primitive::undefinedValue(); | - | ||||||||||||||||||||||||
| 115 | const Value *index = argc > 1
| 0-48 | ||||||||||||||||||||||||
| 116 | ScopedPropertyKey name(scope, index->toPropertyKey(scope.engine)); | - | ||||||||||||||||||||||||
| 117 | if (scope.hasException()
| 4-44 | ||||||||||||||||||||||||
| 118 | return executed 4 times by 1 test: Encode::undefined();return Encode::undefined();Executed by:
executed 4 times by 1 test: return Encode::undefined();Executed by:
| 4 | ||||||||||||||||||||||||
| 119 | ScopedValue receiver(scope, argc > 2 ? argv[2] : *o); | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | return executed 44 times by 1 test: Encode(o->get(name, receiver));return Encode(o->get(name, receiver));Executed by:
executed 44 times by 1 test: return Encode(o->get(name, receiver));Executed by:
| 44 | ||||||||||||||||||||||||
| 122 | } | - | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | ReturnedValue Reflect::method_getOwnPropertyDescriptor(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 125 | { | - | ||||||||||||||||||||||||
| 126 | if (!argc
| 0-148 | ||||||||||||||||||||||||
| 127 | return executed 20 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError();Executed by:
executed 20 times by 1 test: return f->engine()->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | return executed 128 times by 1 test: ObjectPrototype::method_getOwnPropertyDescriptor(f, thisObject, argv, argc);return ObjectPrototype::method_getOwnPropertyDescriptor(f, thisObject, argv, argc);Executed by:
executed 128 times by 1 test: return ObjectPrototype::method_getOwnPropertyDescriptor(f, thisObject, argv, argc);Executed by:
| 128 | ||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | ReturnedValue Reflect::method_getPrototypeOf(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||
| 134 | if (!argc
| 0-36 | ||||||||||||||||||||||||
| 135 | return executed 20 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError();Executed by:
executed 20 times by 1 test: return f->engine()->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | const Object *o = static_cast<const Object *>(argv); | - | ||||||||||||||||||||||||
| 138 | Heap::Object *p = o->getPrototypeOf(); | - | ||||||||||||||||||||||||
| 139 | return executed 16 times by 1 test: (p ? p->asReturnedValue() : Encode::null());return (p ? p->asReturnedValue() : Encode::null());Executed by:
executed 16 times by 1 test: return (p ? p->asReturnedValue() : Encode::null());Executed by:
| 16 | ||||||||||||||||||||||||
| 140 | } | - | ||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | ReturnedValue Reflect::method_has(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | Scope scope(f); | - | ||||||||||||||||||||||||
| 145 | if (!argc
| 0-1067 | ||||||||||||||||||||||||
| 146 | return executed 20 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 20 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | ScopedObject o(scope, static_cast<const Object *>(argv)); | - | ||||||||||||||||||||||||
| 149 | Value undef = Primitive::undefinedValue(); | - | ||||||||||||||||||||||||
| 150 | const Value *index = argc > 1
| 0-1047 | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | ScopedPropertyKey name(scope, index->toPropertyKey(scope.engine)); | - | ||||||||||||||||||||||||
| 153 | if (scope.engine->hasException
| 4-1044 | ||||||||||||||||||||||||
| 154 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | bool hasProperty = false; | - | ||||||||||||||||||||||||
| 157 | (void) o->get(name, nullptr, &hasProperty); | - | ||||||||||||||||||||||||
| 158 | return executed 1044 times by 1 test: Encode(hasProperty);return Encode(hasProperty);Executed by:
executed 1044 times by 1 test: return Encode(hasProperty);Executed by:
| 1044 | ||||||||||||||||||||||||
| 159 | } | - | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | ReturnedValue Reflect::method_isExtensible(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 162 | { | - | ||||||||||||||||||||||||
| 163 | if (!argc
| 0-52 | ||||||||||||||||||||||||
| 164 | return executed 40 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError();Executed by:
executed 40 times by 1 test: return f->engine()->throwTypeError();Executed by:
| 40 | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | const Object *o = static_cast<const Object *>(argv); | - | ||||||||||||||||||||||||
| 167 | return executed 12 times by 1 test: Encode(o->isExtensible());return Encode(o->isExtensible());Executed by:
executed 12 times by 1 test: return Encode(o->isExtensible());Executed by:
| 12 | ||||||||||||||||||||||||
| 168 | } | - | ||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | ReturnedValue Reflect::method_ownKeys(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 172 | { | - | ||||||||||||||||||||||||
| 173 | if (!argc
| 0-72 | ||||||||||||||||||||||||
| 174 | return executed 20 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError();Executed by:
executed 20 times by 1 test: return f->engine()->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | return executed 52 times by 1 test: ObjectPrototype::method_getOwnPropertyNames(f, thisObject, argv, argc);return ObjectPrototype::method_getOwnPropertyNames(f, thisObject, argv, argc);Executed by:
executed 52 times by 1 test: return ObjectPrototype::method_getOwnPropertyNames(f, thisObject, argv, argc);Executed by:
| 52 | ||||||||||||||||||||||||
| 177 | } | - | ||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||
| 179 | ReturnedValue Reflect::method_preventExtensions(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 180 | { | - | ||||||||||||||||||||||||
| 181 | Scope scope(f); | - | ||||||||||||||||||||||||
| 182 | if (!argc
| 0-44 | ||||||||||||||||||||||||
| 183 | return never executed: scope.engine->throwTypeError();return scope.engine->throwTypeError();never executed: return scope.engine->throwTypeError(); | 0 | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | ScopedObject o(scope, static_cast<const Object *>(argv)); | - | ||||||||||||||||||||||||
| 186 | return executed 44 times by 1 test: Encode(o->preventExtensions());return Encode(o->preventExtensions());Executed by:
executed 44 times by 1 test: return Encode(o->preventExtensions());Executed by:
| 44 | ||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | ReturnedValue Reflect::method_set(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 190 | { | - | ||||||||||||||||||||||||
| 191 | Scope scope(f); | - | ||||||||||||||||||||||||
| 192 | if (!argc
| 0-855 | ||||||||||||||||||||||||
| 193 | return executed 20 times by 1 test: scope.engine->throwTypeError();return scope.engine->throwTypeError();Executed by:
executed 20 times by 1 test: return scope.engine->throwTypeError();Executed by:
| 20 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | ScopedObject o(scope, static_cast<const Object *>(argv)); | - | ||||||||||||||||||||||||
| 196 | Value undef = Primitive::undefinedValue(); | - | ||||||||||||||||||||||||
| 197 | const Value *index = argc > 1
| 0-835 | ||||||||||||||||||||||||
| 198 | const Value &val = argc > 2
| 4-831 | ||||||||||||||||||||||||
| 199 | ScopedValue receiver(scope, argc >3 ? argv[3] : argv[0]); | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | ScopedPropertyKey propertyKey(scope, index->toPropertyKey(scope.engine)); | - | ||||||||||||||||||||||||
| 202 | if (scope.engine->hasException
| 4-831 | ||||||||||||||||||||||||
| 203 | return executed 4 times by 1 test: false;return false;Executed by:
executed 4 times by 1 test: return false;Executed by:
| 4 | ||||||||||||||||||||||||
| 204 | bool result = o->put(propertyKey, val, receiver); | - | ||||||||||||||||||||||||
| 205 | return executed 832 times by 1 test: Encode(result);return Encode(result);Executed by:
executed 832 times by 1 test: return Encode(result);Executed by:
| 832 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | ReturnedValue Reflect::method_setPrototypeOf(const FunctionObject *f, const Value *, const Value *argv, int argc) | - | ||||||||||||||||||||||||
| 209 | { | - | ||||||||||||||||||||||||
| 210 | if (argc < 2
| 0-180 | ||||||||||||||||||||||||
| 211 | return executed 40 times by 1 test: f->engine()->throwTypeError();return f->engine()->throwTypeError();Executed by:
executed 40 times by 1 test: return f->engine()->throwTypeError();Executed by:
| 40 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | Scope scope(f); | - | ||||||||||||||||||||||||
| 214 | ScopedObject o(scope, static_cast<const Object *>(argv)); | - | ||||||||||||||||||||||||
| 215 | const Object *proto = argv[1].isNull()
| 16-124 | ||||||||||||||||||||||||
| 216 | return executed 140 times by 1 test: Encode(o->setPrototypeOf(proto));return Encode(o->setPrototypeOf(proto));Executed by:
executed 140 times by 1 test: return Encode(o->setPrototypeOf(proto));Executed by:
| 140 | ||||||||||||||||||||||||
| 217 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |