From e2f016dc81120bcbb7c75b81473b0fa59d426305 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 7 Aug 2021 23:39:54 +0100 Subject: [PATCH] LibJS: Handle PlainYearMonth in ISO{Year,Month,MonthCode,Day} --- .../LibJS/Runtime/Temporal/Calendar.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 8ea51e1ec5..0d6292829f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -718,11 +718,13 @@ i32 iso_year(Object& temporal_object) // NOTE: Asserted by the VERIFY_NOT_REACHED at the end // 2. Return 𝔽(temporalObject.[[ISOYear]]). - // TODO: add the rest of the builtins with a [[ISOYear]] slot (PlainYearMonth, PlainMonthDay) if (is(temporal_object)) return static_cast(temporal_object).iso_year(); if (is(temporal_object)) return static_cast(temporal_object).iso_year(); + if (is(temporal_object)) + return static_cast(temporal_object).iso_year(); + // TODO: PlainMonthDay VERIFY_NOT_REACHED(); } @@ -733,11 +735,13 @@ u8 iso_month(Object& temporal_object) // NOTE: Asserted by the VERIFY_NOT_REACHED at the end // 2. Return 𝔽(temporalObject.[[ISOMonth]]). - // TODO: add the rest of the builtins with a [[ISOMonth]] slot (PlainYearMonth, PlainMonthDay) if (is(temporal_object)) return static_cast(temporal_object).iso_month(); if (is(temporal_object)) return static_cast(temporal_object).iso_month(); + if (is(temporal_object)) + return static_cast(temporal_object).iso_month(); + // TODO: PlainMonthDay VERIFY_NOT_REACHED(); } @@ -748,11 +752,13 @@ String iso_month_code(Object& temporal_object) // NOTE: Asserted by the VERIFY_NOT_REACHED at the end // 2. Return ! BuildISOMonthCode(temporalObject.[[ISOMonth]]). - // TODO: add the rest of the builtins with a [[ISOMonth]] slot (PlainYearMonth, PlainMonthDay) if (is(temporal_object)) return build_iso_month_code(static_cast(temporal_object).iso_month()); if (is(temporal_object)) return build_iso_month_code(static_cast(temporal_object).iso_month()); + if (is(temporal_object)) + return build_iso_month_code(static_cast(temporal_object).iso_month()); + // TODO: PlainMonthDay VERIFY_NOT_REACHED(); } @@ -763,11 +769,13 @@ u8 iso_day(Object& temporal_object) // NOTE: Asserted by the VERIFY_NOT_REACHED at the end // 2. Return 𝔽(temporalObject.[[ISODay]]). - // TODO: add the rest of the builtins with a [[ISODay]] slot (PlainYearMonth, PlainMonthDay) if (is(temporal_object)) return static_cast(temporal_object).iso_day(); if (is(temporal_object)) return static_cast(temporal_object).iso_day(); + if (is(temporal_object)) + return static_cast(temporal_object).iso_day(); + // TODO: PlainMonthDay VERIFY_NOT_REACHED(); }