mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 17:48:37 +00:00
LibJS: Extract exception check duplication in iso_month_day_from_fields
Flagged by sonarcloud.
This commit is contained in:
parent
eb326db028
commit
fc1b9288bc
Notes:
sideshowbarker
2024-07-18 04:02:22 +09:00
Author: https://github.com/bgianfo
Commit: fc1b9288bc
Pull-request: https://github.com/SerenityOS/serenity/pull/10013
Reviewed-by: https://github.com/IdanHo ✅
Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 4 deletions
|
@ -946,16 +946,14 @@ Optional<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_object, Obj
|
|||
if (month_code.is_undefined()) {
|
||||
// a. Let result be ? RegulateISODate(year, month, day, overflow).
|
||||
result = regulate_iso_date(global_object, year.as_double(), month, day.as_double(), *overflow);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
}
|
||||
// 13. Else,
|
||||
else {
|
||||
// a. Let result be ? RegulateISODate(referenceISOYear, month, day, overflow).
|
||||
result = regulate_iso_date(global_object, reference_iso_year, month, day.as_double(), *overflow);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
}
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
// 14. Return the Record { [[Month]]: result.[[Month]], [[Day]]: result.[[Day]], [[ReferenceISOYear]]: referenceISOYear }.
|
||||
return ISOMonthDay { .month = result->month, .day = result->day, .reference_iso_year = reference_iso_year };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue