mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:47:34 +00:00
LibJS: Convert to_integer_throw_on_infinity() to ThrowCompletionOr
This commit is contained in:
parent
fea27143e9
commit
683e31e1ff
10 changed files with 46 additions and 125 deletions
|
@ -64,14 +64,10 @@ Value PlainYearMonthConstructor::construct(FunctionObject& new_target)
|
|||
}
|
||||
|
||||
// 3. Let y be ? ToIntegerThrowOnInfinity(isoYear).
|
||||
auto y = to_integer_throw_on_infinity(global_object, iso_year, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto y = TRY_OR_DISCARD(to_integer_throw_on_infinity(global_object, iso_year, ErrorType::TemporalInvalidPlainYearMonth));
|
||||
|
||||
// 4. Let m be ? ToIntegerThrowOnInfinity(isoMonth).
|
||||
auto m = to_integer_throw_on_infinity(global_object, iso_month, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto m = TRY_OR_DISCARD(to_integer_throw_on_infinity(global_object, iso_month, ErrorType::TemporalInvalidPlainYearMonth));
|
||||
|
||||
// 5. Let calendar be ? ToTemporalCalendarWithISODefault(calendarLike).
|
||||
auto* calendar = to_temporal_calendar_with_iso_default(global_object, calendar_like);
|
||||
|
@ -79,9 +75,7 @@ Value PlainYearMonthConstructor::construct(FunctionObject& new_target)
|
|||
return {};
|
||||
|
||||
// 6. Let ref be ? ToIntegerThrowOnInfinity(referenceISODay).
|
||||
auto ref = to_integer_throw_on_infinity(global_object, reference_iso_day, ErrorType::TemporalInvalidPlainYearMonth);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto ref = TRY_OR_DISCARD(to_integer_throw_on_infinity(global_object, reference_iso_day, ErrorType::TemporalInvalidPlainYearMonth));
|
||||
|
||||
// IMPLEMENTATION DEFINED: This is an optimization that allows us to treat these doubles as normal integers from this point onwards.
|
||||
// This does not change the exposed behavior as the call to CreateTemporalYearMonth will immediately check that these values are valid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue