LibJS: Mark TemporalDurationFromInternal as infallible in difference AOs

This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/76c6612
This commit is contained in:
Timothy Flynn 2024-12-05 09:51:55 -05:00 committed by Tim Flynn
parent 81b38c66a8
commit 4f07cddb2d
Notes: github-actions[bot] 2024-12-05 21:07:07 +00:00
3 changed files with 6 additions and 6 deletions

View file

@ -405,8 +405,8 @@ ThrowCompletionOr<GC::Ref<Duration>> difference_temporal_plain_date_time(VM& vm,
// 6. Let internalDuration be ? DifferencePlainDateTimeWithRounding(dateTime.[[ISODateTime]], other.[[ISODateTime]], dateTime.[[Calendar]], settings.[[LargestUnit]], settings.[[RoundingIncrement]], settings.[[SmallestUnit]], settings.[[RoundingMode]]).
auto internal_duration = TRY(difference_plain_date_time_with_rounding(vm, date_time.iso_date_time(), other->iso_date_time(), date_time.calendar(), settings.largest_unit, settings.rounding_increment, settings.smallest_unit, settings.rounding_mode));
// 7. Let result be ? TemporalDurationFromInternal(internalDuration, settings.[[LargestUnit]]).
auto result = TRY(temporal_duration_from_internal(vm, internal_duration, settings.largest_unit));
// 7. Let result be ! TemporalDurationFromInternal(internalDuration, settings.[[LargestUnit]]).
auto result = MUST(temporal_duration_from_internal(vm, internal_duration, settings.largest_unit));
// 8. If operation is SINCE, set result to CreateNegatedTemporalDuration(result).
if (operation == DurationOperation::Since)

View file

@ -259,8 +259,8 @@ ThrowCompletionOr<GC::Ref<Duration>> difference_temporal_plain_year_month(VM& vm
duration = TRY(round_relative_duration(vm, move(duration), dest_epoch_ns, iso_date_time, {}, calendar, settings.largest_unit, settings.rounding_increment, settings.smallest_unit, settings.rounding_mode));
}
// 17. Let result be ? TemporalDurationFromInternal(duration, DAY).
auto result = TRY(temporal_duration_from_internal(vm, duration, Unit::Day));
// 17. Let result be ! TemporalDurationFromInternal(duration, DAY).
auto result = MUST(temporal_duration_from_internal(vm, duration, Unit::Day));
// 18. If operation is SINCE, set result to CreateNegatedTemporalDuration(result).
if (operation == DurationOperation::Since)

View file

@ -576,8 +576,8 @@ ThrowCompletionOr<GC::Ref<Duration>> difference_temporal_zoned_date_time(VM& vm,
// 9. Let internalDuration be ? DifferenceZonedDateTimeWithRounding(zonedDateTime.[[EpochNanoseconds]], other.[[EpochNanoseconds]], zonedDateTime.[[TimeZone]], zonedDateTime.[[Calendar]], settings.[[LargestUnit]], settings.[[RoundingIncrement]], settings.[[SmallestUnit]], settings.[[RoundingMode]]).
auto internal_duration = TRY(difference_zoned_date_time_with_rounding(vm, zoned_date_time.epoch_nanoseconds()->big_integer(), other->epoch_nanoseconds()->big_integer(), zoned_date_time.time_zone(), zoned_date_time.calendar(), settings.largest_unit, settings.rounding_increment, settings.smallest_unit, settings.rounding_mode));
// 10. Let result be ? TemporalDurationFromInternal(internalDuration, HOUR).
auto result = TRY(temporal_duration_from_internal(vm, internal_duration, Unit::Hour));
// 10. Let result be ! TemporalDurationFromInternal(internalDuration, HOUR).
auto result = MUST(temporal_duration_from_internal(vm, internal_duration, Unit::Hour));
// 11. If operation is SINCE, set result to CreateNegatedTemporalDuration(result).
if (operation == DurationOperation::Since)