diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-09-12 21:10:49 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-09-13 14:05:22 +0000 |
commit | fc1b9288bc74bd9ce23c250e47f6aecd0e50bd11 (patch) | |
tree | c351b8484d5a3b0df2f0022f758d91e16c4af6ba /Userland/Libraries/LibJS | |
parent | eb326db0281989457c2896a75dc06a0351de9b8f (diff) | |
download | serenity-fc1b9288bc74bd9ce23c250e47f6aecd0e50bd11.zip |
LibJS: Extract exception check duplication in iso_month_day_from_fields
Flagged by sonarcloud.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 9a7909902e..7be2315cfe 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -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 }; |