diff options
author | Linus Groh <mail@linusgroh.de> | 2023-01-26 15:24:16 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-26 20:20:54 +0000 |
commit | 269f3c41058348a5c99634c8be2585a37d499f21 (patch) | |
tree | 63c56c1cf8204c8d4c582adec2b0b20116c1d820 /Userland/Libraries | |
parent | 627291b075414e0885182d046fee070cb1aae6c6 (diff) | |
download | serenity-269f3c41058348a5c99634c8be2585a37d499f21.zip |
LibJS: Port maybe_format_calendar_annotation() to String
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 6358ee3c21..b653618d79 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -565,20 +565,20 @@ ThrowCompletionOr<PlainMonthDay*> calendar_month_day_from_fields(VM& vm, Object& } // 12.2.27 MaybeFormatCalendarAnnotation ( calendarObject, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-maybeformatcalendarannotation -ThrowCompletionOr<DeprecatedString> maybe_format_calendar_annotation(VM& vm, Object const* calendar_object, StringView show_calendar) +ThrowCompletionOr<String> maybe_format_calendar_annotation(VM& vm, Object const* calendar_object, StringView show_calendar) { // 1. If showCalendar is "never", return the empty String. if (show_calendar == "never"sv) - return DeprecatedString::empty(); + return String {}; // 2. Assert: Type(calendarObject) is Object. VERIFY(calendar_object); // 3. Let calendarID be ? ToString(calendarObject). - auto calendar_id = TRY(Value(calendar_object).to_deprecated_string(vm)); + auto calendar_id = TRY(Value(calendar_object).to_string(vm)); // 4. Return FormatCalendarAnnotation(calendarID, showCalendar). - return format_calendar_annotation(calendar_id, show_calendar); + return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(format_calendar_annotation(calendar_id, show_calendar))); } // 12.2.28 FormatCalendarAnnotation ( id, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-formatcalendarannotation diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h index aad45f3a7b..2b438c1079 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h @@ -67,7 +67,7 @@ ThrowCompletionOr<Object*> get_temporal_calendar_with_iso_default(VM&, Object&); ThrowCompletionOr<PlainDate*> calendar_date_from_fields(VM&, Object& calendar, Object const& fields, Object const* options = nullptr); ThrowCompletionOr<PlainYearMonth*> calendar_year_month_from_fields(VM&, Object& calendar, Object const& fields, Object const* options = nullptr); ThrowCompletionOr<PlainMonthDay*> calendar_month_day_from_fields(VM&, Object& calendar, Object const& fields, Object const* options = nullptr); -ThrowCompletionOr<DeprecatedString> maybe_format_calendar_annotation(VM&, Object const* calendar_object, StringView show_calendar); +ThrowCompletionOr<String> maybe_format_calendar_annotation(VM&, Object const* calendar_object, StringView show_calendar); DeprecatedString format_calendar_annotation(StringView id, StringView show_calendar); ThrowCompletionOr<bool> calendar_equals(VM&, Object& one, Object& two); ThrowCompletionOr<Object*> consolidate_calendars(VM&, Object& one, Object& two); |