Lines Matching defs:target

22 // ecma 26.1.1 Reflect.apply (target, thisArgument, argumentsList)
29 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
32 return ReflectApplyInternal(thread, target, thisArgument, argumentsList);
35 JSTaggedValue BuiltinsReflect::ReflectApplyInternal(JSThread *thread, JSHandle<JSTaggedValue> target,
40 // 1. If IsCallable(target) is false, throw a TypeError exception.
41 if (!target->IsCallable()) {
42 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.apply target is not callable", JSTaggedValue::Exception());
50 // 4. Return ? Call(target, thisArgument, args).
54 EcmaInterpreter::NewRuntimeCallInfo(thread, target, thisArgument, undefined, argsLength);
60 // ecma 26.1.2 Reflect.construct (target, argumentsList [ , newTarget])
67 // 1. If IsConstructor(target) is false, throw a TypeError exception.
68 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
69 if (!target->IsConstructor()) {
70 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.construct target is not constructor", JSTaggedValue::Exception());
72 // 2. If newTarget is not present, set newTarget to target.
74 argv->GetArgsNumber() > 2 ? GetCallArg(argv, BuiltinsBase::ArgsPosition::THIRD) : target; // 2: num args
85 return ReflectConstructInternal(thread, target, args, newTarget);
88 JSTaggedValue BuiltinsReflect::ReflectConstructInternal(JSThread *thread, JSHandle<JSTaggedValue> target,
92 // 5. Return ? Construct(target, args, newTarget).
95 EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, target, undefined, newTarget, argsLength);
101 // ecma 26.1.3 Reflect.defineProperty (target, propertyKey, attributes)
108 // 1. If Type(target) is not Object, throw a TypeError exception.
109 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
110 if (!target->IsECMAObject()) {
111 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.defineProperty target is not object", JSTaggedValue::Exception());
121 // 4. Return ? target.[[DefineOwnProperty]](key, desc).
122 return GetTaggedBoolean(JSTaggedValue::DefineOwnProperty(thread, target, key, desc));
125 // ecma 21.1.4 Reflect.deleteProperty (target, propertyKey)
132 // 1. If Type(target) is not Object, throw a TypeError exception.
133 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
134 if (!target->IsECMAObject()) {
135 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.deleteProperty target is not object", JSTaggedValue::Exception());
140 // 3. Return ? target.[[Delete]](key).
141 return GetTaggedBoolean(JSTaggedValue::DeleteProperty(thread, target, key));
144 // ecma 26.1.5 Reflect.get (target, propertyKey [ , receiver])
151 // 1. If Type(target) is not Object, throw a TypeError exception.
154 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.get target is not object", JSTaggedValue::Exception());
160 // a. Set receiver to target.
161 // 4. Return ? target.[[Get]](key, receiver).
169 // ecma 26.1.6 Reflect.getOwnPropertyDescriptor ( target, propertyKey )
176 // 1. If Type(target) is not Object, throw a TypeError exception.
177 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
178 if (!target->IsECMAObject()) {
179 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.getOwnPropertyDescriptor target is not object",
185 // 3. Let desc be ? target.[[GetOwnProperty]](key).
187 if (!JSTaggedValue::GetOwnProperty(thread, target, key, desc)) {
195 // ecma 21.1.7 Reflect.getPrototypeOf (target)
202 // 1. If Type(target) is not Object, throw a TypeError exception.
205 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.getPrototypeOf target is not object", JSTaggedValue::Exception());
207 // 2. Return ? target.[[GetPrototypeOf]]().
211 // ecma 26.1.8 Reflect.has (target, propertyKey)
218 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
220 return ReflectHasInternal(thread, target, key);
223 JSTaggedValue BuiltinsReflect::ReflectHasInternal(JSThread *thread, JSHandle<JSTaggedValue> target,
227 // 1. If Type(target) is not Object, throw a TypeError exception.
228 if (!target->IsECMAObject()) {
229 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.has target is not object", JSTaggedValue::Exception());
234 // 3. Return ? target.[[HasProperty]](key).
235 return GetTaggedBoolean(JSTaggedValue::HasProperty(thread, target, propertyKey));
238 // ecma 26.1.9 Reflect.isExtensible (target)
244 // 1. If Type(target) is not Object, throw a TypeError exception.
245 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
246 if (!target->IsECMAObject()) {
247 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.isExtensible target is not object", JSTaggedValue::Exception());
249 // 2. Return ? target.[[IsExtensible]]().
250 return GetTaggedBoolean(target->IsExtensible(thread));
253 // ecma 26.1.10 Reflect.ownKeys (target)
260 // 1. If Type(target) is not Object, throw a TypeError exception.
261 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
262 if (!target->IsECMAObject()) {
263 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.ownKeys target is not object", JSTaggedValue::Exception());
265 // 2. Let keys be ? target.[[OwnPropertyKeys]]().
266 JSHandle<TaggedArray> keys = JSTaggedValue::GetOwnPropertyKeys(thread, target);
273 // ecma 26.1.11 Reflect.preventExtensions (target)
280 // 1. If Type(target) is not Object, throw a TypeError exception.
281 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
282 if (!target->IsECMAObject()) {
283 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.preventExtensions target is not object",
286 // 2. Return ? target.[[PreventExtensions]]().
287 return GetTaggedBoolean(JSTaggedValue::PreventExtensions(thread, target));
290 // ecma 26.1.12 Reflect.set (target, propertyKey, V [ , receiver])
297 // 1. If Type(target) is not Object, throw a TypeError exception.
300 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.set target is not object", JSTaggedValue::Exception());
307 // a. Set receiver to target.
308 // 4. Return ? target.[[Set]](key, receiver).
316 // ecma 26.1.13 Reflect.setPrototypeOf (target, proto)
323 // 1. If Type(target) is not Object, throw a TypeError exception.
324 JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
325 if (!target->IsECMAObject()) {
326 THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.setPrototypeOf target is not object", JSTaggedValue::Exception());
334 // 3. Return ? target.[[SetPrototypeOf]](proto).
335 return GetTaggedBoolean(JSTaggedValue::SetPrototype(thread, target, proto));