1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Add and use the %ThrowTypeError% intrinsic

This commit is contained in:
Idan Horowitz 2021-06-28 03:53:35 +03:00 committed by Linus Groh
parent 581f20e6f2
commit e2e695bc9f
5 changed files with 22 additions and 7 deletions

View file

@ -210,7 +210,6 @@ Value perform_eval(Value x, GlobalObject& caller_realm, CallerMode strict_caller
Object* create_unmapped_arguments_object(GlobalObject& global_object, Vector<Value> const& arguments)
{
auto& vm = global_object.vm();
// FIXME: This should use OrdinaryObjectCreate
auto* object = Object::create(global_object, global_object.object_prototype());
if (vm.exception())
return nullptr;
@ -226,12 +225,8 @@ Object* create_unmapped_arguments_object(GlobalObject& global_object, Vector<Val
for (auto& argument : arguments)
object->indexed_properties().append(argument);
// FIXME: 8. Perform ! DefinePropertyOrThrow(obj, "callee", PropertyDescriptor { [[Get]]: %ThrowTypeError%, [[Set]]: %ThrowTypeError%, [[Enumerable]]: false, [[Configurable]]: false }).
PropertyAttributes attributes;
attributes.set_has_configurable();
attributes.set_has_enumerable();
object->define_property(vm.names.callee, js_undefined(), attributes);
// 8. Perform ! DefinePropertyOrThrow(obj, "callee", PropertyDescriptor { [[Get]]: %ThrowTypeError%, [[Set]]: %ThrowTypeError%, [[Enumerable]]: false, [[Configurable]]: false }).
object->define_accessor(vm.names.callee, global_object.throw_type_error_function(), global_object.throw_type_error_function(), 0);
if (vm.exception())
return nullptr;