blob: 3db0968f103c566bfae4f6bb30d11160d8dd705b [file] [log] [blame]
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace reflect {
const kCalledOnNonObject: constexpr MessageTemplate
generates 'MessageTemplate::kCalledOnNonObject';
// ES6 section 26.1.10 Reflect.isExtensible
transitioning javascript builtin ReflectIsExtensible(
js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.isExtensible');
return object::ObjectIsExtensible(objectJSReceiver);
}
// ES6 section 26.1.12 Reflect.preventExtensions
transitioning javascript builtin ReflectPreventExtensions(
js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.preventExtensions');
return object::ObjectPreventExtensionsDontThrow(objectJSReceiver);
}
// ES6 section 26.1.8 Reflect.getPrototypeOf
transitioning javascript builtin ReflectGetPrototypeOf(
js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.getPrototypeOf');
return object::JSReceiverGetPrototypeOf(objectJSReceiver);
}
// ES6 section 26.1.14 Reflect.setPrototypeOf
transitioning javascript builtin ReflectSetPrototypeOf(
js-implicit context:
Context)(_receiver: Object, object: Object, proto: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf');
if (proto == Null || Is<JSReceiver>(proto)) {
return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto);
}
ThrowTypeError(kProtoObjectOrNull, proto);
}
} // namespace reflect