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

LibJS: Use ThrowCompletionOr in create_list_from_array_like()

Also add spec step comments to it while we're here.
This commit is contained in:
Linus Groh 2021-09-15 20:55:07 +01:00
parent 568296d0cc
commit c4c40f4cf3
5 changed files with 42 additions and 29 deletions

View file

@ -61,9 +61,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::apply)
}
// 2. Let args be ? CreateListFromArrayLike(argumentsList).
auto args = create_list_from_array_like(global_object, arguments_list);
if (vm.exception())
return {};
auto args = TRY_OR_DISCARD(create_list_from_array_like(global_object, arguments_list));
// 3. Perform PrepareForTailCall().
// 4. Return ? Call(target, thisArgument, args).
@ -94,9 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::construct)
}
// 4. Let args be ? CreateListFromArrayLike(argumentsList).
auto args = create_list_from_array_like(global_object, arguments_list);
if (vm.exception())
return {};
auto args = TRY_OR_DISCARD(create_list_from_array_like(global_object, arguments_list));
// 5. Return ? Construct(target, args, newTarget).
return vm.construct(target.as_function(), new_target.as_function(), move(args));