1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:28:13 +00:00

LibJS: Implement the CreateListFromArrayLike() abstract operation

We already have two separate implementations of this, so let's do it
properly. The optional value type check is done by a callback function
that returns Result<void, ErrorType> - value type accepted or message
for TypeError, that is.
This commit is contained in:
Linus Groh 2021-06-09 23:27:01 +01:00
parent 5da94b30eb
commit ad7aa05cc6
3 changed files with 36 additions and 0 deletions

View file

@ -11,6 +11,8 @@
#include <AK/BitCast.h>
#include <AK/Format.h>
#include <AK/Forward.h>
#include <AK/Function.h>
#include <AK/Result.h>
#include <AK/String.h>
#include <AK/Types.h>
#include <LibJS/Forward.h>
@ -372,6 +374,7 @@ Function* get_method(GlobalObject& global_object, Value, const PropertyName&);
size_t length_of_array_like(GlobalObject&, const Object&);
Object* species_constructor(GlobalObject&, const Object&, Object& default_constructor);
Value require_object_coercible(GlobalObject&, Value);
MarkedValueList create_list_from_array_like(GlobalObject&, Value, AK::Function<Result<void, ErrorType>(Value)> = {});
}