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

LibJS: Make CreateTemporalDuration return a NonnullGCPtr

Since it can't return null.

This also results in a bunch of fallout from callers who were
expecting a raw pointer.
This commit is contained in:
Shannon Booth 2024-02-10 14:41:30 +13:00 committed by Tim Flynn
parent fdfe06bb44
commit 6d4eda0028
17 changed files with 52 additions and 52 deletions

View file

@ -84,7 +84,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DurationConstructor::construct(FunctionO
auto ns = TRY(to_integer_if_integral(vm, vm.argument(9), ErrorType::TemporalInvalidDuration));
// 12. Return ? CreateTemporalDuration(y, mo, w, d, h, m, s, ms, mis, ns, NewTarget).
return *TRY(create_temporal_duration(vm, y, mo, w, d, h, m, s, ms, mis, ns, &new_target));
return TRY(create_temporal_duration(vm, y, mo, w, d, h, m, s, ms, mis, ns, &new_target));
}
// 7.2.2 Temporal.Duration.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.duration.from
@ -108,10 +108,10 @@ JS_DEFINE_NATIVE_FUNCTION(DurationConstructor::from)
JS_DEFINE_NATIVE_FUNCTION(DurationConstructor::compare)
{
// 1. Set one to ? ToTemporalDuration(one).
auto* one = TRY(to_temporal_duration(vm, vm.argument(0)));
auto one = TRY(to_temporal_duration(vm, vm.argument(0)));
// 2. Set two to ? ToTemporalDuration(two).
auto* two = TRY(to_temporal_duration(vm, vm.argument(1)));
auto two = TRY(to_temporal_duration(vm, vm.argument(1)));
// 3. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(2)));