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

LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-09-16 00:57:38 +03:00 committed by Linus Groh
parent b61eff8730
commit 5a4c90fcb1
30 changed files with 38 additions and 93 deletions

View file

@ -31,8 +31,6 @@ Calendar::Calendar(String identifier, Object& prototype)
// 12.1.1 CreateTemporalCalendar ( identifier [ , newTarget ] ), https://tc39.es/proposal-temporal/#sec-temporal-createtemporalcalendar
Calendar* create_temporal_calendar(GlobalObject& global_object, String const& identifier, FunctionObject const* new_target)
{
auto& vm = global_object.vm();
// 1. Assert: ! IsBuiltinCalendar(identifier) is true.
VERIFY(is_builtin_calendar(identifier));
@ -42,9 +40,7 @@ Calendar* create_temporal_calendar(GlobalObject& global_object, String const& id
// 3. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Calendar.prototype%", « [[InitializedTemporalCalendar]], [[Identifier]] »).
// 4. Set object.[[Identifier]] to identifier.
auto* object = ordinary_create_from_constructor<Calendar>(global_object, *new_target, &GlobalObject::temporal_calendar_prototype, identifier);
if (vm.exception())
return {};
auto* object = TRY_OR_DISCARD(ordinary_create_from_constructor<Calendar>(global_object, *new_target, &GlobalObject::temporal_calendar_prototype, identifier));
// 5. Return object.
return object;