1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

LibJS: Store the %Array.prototype.values% intrinsic on the global object

Also group the getter functions for all the additional intrinsics (not
generated via macros), and initialize the members.
This commit is contained in:
Linus Groh 2021-07-25 19:37:42 +01:00
parent 50472fd69f
commit 1c1354db07
3 changed files with 15 additions and 18 deletions

View file

@ -435,10 +435,7 @@ Object* create_unmapped_arguments_object(GlobalObject& global_object, Vector<Val
}
// 7. Perform ! DefinePropertyOrThrow(obj, @@iterator, PropertyDescriptor { [[Value]]: %Array.prototype.values%, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }).
// FIXME: This is not guaranteed to be %Array.prototype.values%!
auto array_prototype_values = global_object.array_prototype()->get(vm.names.values);
if (vm.exception())
return {};
auto* array_prototype_values = global_object.array_prototype_values_function();
object->define_property_or_throw(*vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true });
VERIFY(!vm.exception());
@ -530,10 +527,7 @@ Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObje
}
// 20. Perform ! DefinePropertyOrThrow(obj, @@iterator, PropertyDescriptor { [[Value]]: %Array.prototype.values%, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }).
// FIXME: This is not guaranteed to be %Array.prototype.values%!
auto array_prototype_values = global_object.array_prototype()->get(vm.names.values);
if (vm.exception())
return {};
auto* array_prototype_values = global_object.array_prototype_values_function();
object->define_property_or_throw(*vm.well_known_symbol_iterator(), { .value = array_prototype_values, .writable = true, .enumerable = false, .configurable = true });
VERIFY(!vm.exception());