mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr
This commit is contained in:
parent
b61eff8730
commit
5a4c90fcb1
30 changed files with 38 additions and 93 deletions
|
@ -51,8 +51,6 @@ bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds)
|
|||
// 8.5.2 CreateTemporalInstant ( epochNanoseconds [ , newTarget ] ), https://tc39.es/proposal-temporal/#sec-temporal-createtemporalinstant
|
||||
Instant* create_temporal_instant(GlobalObject& global_object, BigInt const& epoch_nanoseconds, FunctionObject const* new_target)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
// 1. Assert: Type(epochNanoseconds) is BigInt.
|
||||
|
||||
// 2. Assert: ! IsValidEpochNanoseconds(epochNanoseconds) is true.
|
||||
|
@ -64,9 +62,7 @@ Instant* create_temporal_instant(GlobalObject& global_object, BigInt const& epoc
|
|||
|
||||
// 4. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Instant.prototype%", « [[InitializedTemporalInstant]], [[Nanoseconds]] »).
|
||||
// 5. Set object.[[Nanoseconds]] to epochNanoseconds.
|
||||
auto* object = ordinary_create_from_constructor<Instant>(global_object, *new_target, &GlobalObject::temporal_instant_prototype, epoch_nanoseconds);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto* object = TRY_OR_DISCARD(ordinary_create_from_constructor<Instant>(global_object, *new_target, &GlobalObject::temporal_instant_prototype, epoch_nanoseconds));
|
||||
|
||||
// 6. Return object.
|
||||
return object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue