| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2022-01-09 19:12:24 +01:00
										 |  |  |  * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org> | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Function.h>
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | #include <LibJS/Runtime/AbstractOperations.h>
 | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | #include <LibJS/Runtime/Array.h>
 | 
					
						
							|  |  |  | #include <LibJS/Runtime/ArrayConstructor.h>
 | 
					
						
							| 
									
										
										
										
											2020-05-08 16:23:56 +01:00
										 |  |  | #include <LibJS/Runtime/Error.h>
 | 
					
						
							| 
									
										
										
										
											2020-04-18 13:18:06 +02:00
										 |  |  | #include <LibJS/Runtime/GlobalObject.h>
 | 
					
						
							| 
									
										
										
										
											2020-08-17 09:52:24 -04:00
										 |  |  | #include <LibJS/Runtime/IteratorOperations.h>
 | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | #include <LibJS/Runtime/Shape.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace JS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  | ArrayConstructor::ArrayConstructor(Realm& realm) | 
					
						
							| 
									
										
										
										
											2022-09-14 19:10:27 -04:00
										 |  |  |     : NativeFunction(realm.vm().names.Array.as_string(), *realm.intrinsics().function_prototype()) | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-06-20 15:40:48 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  | void ArrayConstructor::initialize(Realm& realm) | 
					
						
							| 
									
										
										
										
											2020-06-20 15:40:48 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-10-13 23:49:19 +02:00
										 |  |  |     auto& vm = this->vm(); | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  |     NativeFunction::initialize(realm); | 
					
						
							| 
									
										
										
										
											2020-06-20 15:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  |     // 23.1.2.4 Array.prototype, https://tc39.es/ecma262/#sec-array.prototype
 | 
					
						
							| 
									
										
										
										
											2022-08-27 00:54:55 +01:00
										 |  |  |     define_direct_property(vm.names.prototype, realm.intrinsics().array_prototype(), 0); | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-08 16:28:35 +01:00
										 |  |  |     u8 attr = Attribute::Writable | Attribute::Configurable; | 
					
						
							| 
									
										
										
										
											2022-08-22 21:47:35 +01:00
										 |  |  |     define_native_function(realm, vm.names.from, from, 1, attr); | 
					
						
							|  |  |  |     define_native_function(realm, vm.names.isArray, is_array, 1, attr); | 
					
						
							|  |  |  |     define_native_function(realm, vm.names.of, of, 0, attr); | 
					
						
							| 
									
										
										
										
											2021-06-07 19:31:32 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  |     // 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species
 | 
					
						
							| 
									
										
										
										
											2022-08-22 21:47:35 +01:00
										 |  |  |     define_native_accessor(realm, *vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable); | 
					
						
							| 
									
										
										
										
											2021-07-08 02:49:53 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     define_direct_property(vm.names.length, Value(1), Attribute::Configurable); | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | // 23.1.1.1 Array ( ...values ), https://tc39.es/ecma262/#sec-array
 | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  | ThrowCompletionOr<Value> ArrayConstructor::call() | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  |     return TRY(construct(*this)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 23.1.1.1 Array ( ...values ), https://tc39.es/ecma262/#sec-array
 | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  | ThrowCompletionOr<Object*> ArrayConstructor::construct(FunctionObject& new_target) | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | { | 
					
						
							|  |  |  |     auto& vm = this->vm(); | 
					
						
							| 
									
										
										
										
											2022-08-22 19:00:49 +01:00
										 |  |  |     auto& realm = *vm.current_realm(); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-27 00:54:55 +01:00
										 |  |  |     auto* proto = TRY(get_prototype_from_constructor(vm, new_target, &Intrinsics::array_prototype)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (vm.argument_count() == 0) | 
					
						
							| 
									
										
										
										
											2022-12-13 20:49:49 +00:00
										 |  |  |         return MUST(Array::create(realm, 0, proto)).ptr(); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (vm.argument_count() == 1) { | 
					
						
							|  |  |  |         auto length = vm.argument(0); | 
					
						
							| 
									
										
										
										
											2022-12-13 20:49:49 +00:00
										 |  |  |         auto array = MUST(Array::create(realm, 0, proto)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |         size_t int_length; | 
					
						
							|  |  |  |         if (!length.is_number()) { | 
					
						
							| 
									
										
										
										
											2021-10-03 01:18:46 +01:00
										 |  |  |             MUST(array->create_data_property_or_throw(0, length)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |             int_length = 1; | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2022-08-21 14:00:56 +01:00
										 |  |  |             int_length = MUST(length.to_u32(vm)); | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  |             if (int_length != length.as_double()) | 
					
						
							| 
									
										
										
										
											2022-08-16 20:33:17 +01:00
										 |  |  |                 return vm.throw_completion<RangeError>(ErrorType::InvalidLength, "array"); | 
					
						
							| 
									
										
										
										
											2020-05-08 16:23:56 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-10-20 21:16:30 +01:00
										 |  |  |         TRY(array->set(vm.names.length, Value(int_length), Object::ShouldThrowExceptions::Yes)); | 
					
						
							| 
									
										
										
										
											2022-12-13 20:49:49 +00:00
										 |  |  |         return array.ptr(); | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-13 20:49:49 +00:00
										 |  |  |     auto array = TRY(Array::create(realm, vm.argument_count(), proto)); | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |     for (size_t k = 0; k < vm.argument_count(); ++k) | 
					
						
							| 
									
										
										
										
											2021-10-03 01:18:46 +01:00
										 |  |  |         MUST(array->create_data_property_or_throw(k, vm.argument(k))); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-13 20:49:49 +00:00
										 |  |  |     return array.ptr(); | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | // 23.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] ), https://tc39.es/ecma262/#sec-array.from
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  | JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from) | 
					
						
							| 
									
										
										
										
											2020-08-17 09:52:24 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-08-22 11:48:08 +01:00
										 |  |  |     auto& realm = *vm.current_realm(); | 
					
						
							| 
									
										
										
										
											2022-08-20 09:48:43 +01:00
										 |  |  |     auto constructor = vm.this_value(); | 
					
						
							| 
									
										
										
										
											2020-08-17 09:52:24 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-27 21:48:34 +02:00
										 |  |  |     FunctionObject* map_fn = nullptr; | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |     if (!vm.argument(1).is_undefined()) { | 
					
						
							|  |  |  |         auto callback = vm.argument(1); | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |         if (!callback.is_function()) | 
					
						
							| 
									
										
										
										
											2022-08-16 20:33:17 +01:00
										 |  |  |             return vm.throw_completion<TypeError>(ErrorType::NotAFunction, callback.to_string_without_side_effects()); | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |         map_fn = &callback.as_function(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-12 11:59:26 +03:00
										 |  |  |     auto this_arg = vm.argument(2); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |     auto items = vm.argument(0); | 
					
						
							| 
									
										
										
										
											2022-08-21 14:00:56 +01:00
										 |  |  |     auto using_iterator = TRY(items.get_method(vm, *vm.well_known_symbol_iterator())); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |     if (using_iterator) { | 
					
						
							| 
									
										
										
										
											2021-10-23 01:49:10 +03:00
										 |  |  |         Object* array; | 
					
						
							|  |  |  |         if (constructor.is_constructor()) | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |             array = TRY(JS::construct(vm, constructor.as_function(), {})); | 
					
						
							| 
									
										
										
										
											2021-10-23 01:49:10 +03:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  |             array = MUST(Array::create(realm, 0)); | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |         auto iterator = TRY(get_iterator(vm, items, IteratorHint::Sync, using_iterator)); | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |         size_t k = 0; | 
					
						
							|  |  |  |         while (true) { | 
					
						
							|  |  |  |             if (k >= MAX_ARRAY_LIKE_INDEX) { | 
					
						
							| 
									
										
										
										
											2022-08-16 20:33:17 +01:00
										 |  |  |                 auto error = vm.throw_completion<TypeError>(ErrorType::ArrayMaxSize); | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |                 return TRY(iterator_close(vm, iterator, move(error))); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |             auto* next = TRY(iterator_step(vm, iterator)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |             if (!next) { | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |                 TRY(array->set(vm.names.length, Value(k), Object::ShouldThrowExceptions::Yes)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |                 return array; | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |             auto next_value = TRY(iterator_value(vm, *next)); | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |             Value mapped_value; | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |             if (map_fn) { | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |                 auto mapped_value_or_error = JS::call(vm, *map_fn, this_arg, next_value, Value(k)); | 
					
						
							| 
									
										
										
										
											2021-10-20 13:36:14 -04:00
										 |  |  |                 if (mapped_value_or_error.is_error()) | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |                     return TRY(iterator_close(vm, iterator, mapped_value_or_error.release_error())); | 
					
						
							| 
									
										
										
										
											2021-09-24 01:41:54 +03:00
										 |  |  |                 mapped_value = mapped_value_or_error.release_value(); | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |                 mapped_value = next_value; | 
					
						
							| 
									
										
										
										
											2021-04-06 23:12:38 +03:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:49:10 +03:00
										 |  |  |             auto result_or_error = array->create_data_property_or_throw(k, mapped_value); | 
					
						
							| 
									
										
										
										
											2021-10-20 13:36:14 -04:00
										 |  |  |             if (result_or_error.is_error()) | 
					
						
							| 
									
										
										
										
											2022-08-21 15:56:27 +01:00
										 |  |  |                 return TRY(iterator_close(vm, iterator, result_or_error.release_error())); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |             ++k; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-21 14:00:56 +01:00
										 |  |  |     auto* array_like = MUST(items.to_object(vm)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |     auto length = TRY(length_of_array_like(vm, *array_like)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:49:10 +03:00
										 |  |  |     Object* array; | 
					
						
							| 
									
										
										
										
											2022-01-25 15:06:40 -05:00
										 |  |  |     if (constructor.is_constructor()) | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |         array = TRY(JS::construct(vm, constructor.as_function(), Value(length))); | 
					
						
							| 
									
										
										
										
											2022-01-25 15:06:40 -05:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  |         array = TRY(Array::create(realm, length)); | 
					
						
							| 
									
										
										
										
											2020-08-17 09:52:24 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |     for (size_t k = 0; k < length; ++k) { | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |         auto k_value = TRY(array_like->get(k)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |         Value mapped_value; | 
					
						
							| 
									
										
										
										
											2021-09-23 20:56:28 +03:00
										 |  |  |         if (map_fn) | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |             mapped_value = TRY(JS::call(vm, *map_fn, this_arg, k_value, Value(k))); | 
					
						
							| 
									
										
										
										
											2021-09-23 20:56:28 +03:00
										 |  |  |         else | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |             mapped_value = k_value; | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |         TRY(array->create_data_property_or_throw(k, mapped_value)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |     TRY(array->set(vm.names.length, Value(length), Object::ShouldThrowExceptions::Yes)); | 
					
						
							| 
									
										
										
										
											2021-07-04 01:36:44 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-17 09:52:24 -04:00
										 |  |  |     return array; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | // 23.1.2.2 Array.isArray ( arg ), https://tc39.es/ecma262/#sec-array.isarray
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  | JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::is_array) | 
					
						
							| 
									
										
										
										
											2020-05-08 16:28:35 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-09-27 18:36:49 +02:00
										 |  |  |     auto value = vm.argument(0); | 
					
						
							| 
									
										
										
										
											2022-08-21 14:00:56 +01:00
										 |  |  |     return Value(TRY(value.is_array(vm))); | 
					
						
							| 
									
										
										
										
											2020-05-08 16:28:35 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | // 23.1.2.3 Array.of ( ...items ), https://tc39.es/ecma262/#sec-array.of
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  | JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of) | 
					
						
							| 
									
										
										
										
											2020-05-08 16:32:56 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-08-22 11:48:08 +01:00
										 |  |  |     auto& realm = *vm.current_realm(); | 
					
						
							| 
									
										
										
										
											2022-08-20 09:48:43 +01:00
										 |  |  |     auto this_value = vm.this_value(); | 
					
						
							| 
									
										
										
										
											2021-10-23 01:49:10 +03:00
										 |  |  |     Object* array; | 
					
						
							| 
									
										
										
										
											2022-01-25 15:06:40 -05:00
										 |  |  |     if (this_value.is_constructor()) | 
					
						
							| 
									
										
										
										
											2022-08-21 19:24:32 +01:00
										 |  |  |         array = TRY(JS::construct(vm, this_value.as_function(), Value(vm.argument_count()))); | 
					
						
							| 
									
										
										
										
											2022-01-25 15:06:40 -05:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2022-08-16 00:20:49 +01:00
										 |  |  |         array = TRY(Array::create(realm, vm.argument_count())); | 
					
						
							| 
									
										
										
										
											2021-10-03 01:18:46 +01:00
										 |  |  |     for (size_t k = 0; k < vm.argument_count(); ++k) | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  |         TRY(array->create_data_property_or_throw(k, vm.argument(k))); | 
					
						
							|  |  |  |     TRY(array->set(vm.names.length, Value(vm.argument_count()), Object::ShouldThrowExceptions::Yes)); | 
					
						
							| 
									
										
										
										
											2020-05-08 16:32:56 +01:00
										 |  |  |     return array; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-13 00:22:35 +01:00
										 |  |  | // 23.1.2.5 get Array [ @@species ], https://tc39.es/ecma262/#sec-get-array-@@species
 | 
					
						
							| 
									
										
										
										
											2021-10-23 01:51:56 +03:00
										 |  |  | JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::symbol_species_getter) | 
					
						
							| 
									
										
										
										
											2021-06-07 19:31:32 +03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-08-20 09:48:43 +01:00
										 |  |  |     return vm.this_value(); | 
					
						
							| 
									
										
										
										
											2021-06-07 19:31:32 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-04 22:28:21 +02:00
										 |  |  | } |