mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47: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:
parent
568296d0cc
commit
c4c40f4cf3
5 changed files with 42 additions and 29 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue