From b41e7b7e86bd9464ae596132be72c3501c8be1b3 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 28 Jan 2023 22:54:44 +0000 Subject: [PATCH] LibJS: Replace to_deprecated_string() with to_string() in Temporal Turns out all of these can already be replaced with no further changes! --- .../LibJS/Runtime/Temporal/AbstractOperations.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp | 10 +++++----- .../LibJS/Runtime/Temporal/CalendarPrototype.cpp | 2 +- .../Libraries/LibJS/Runtime/Temporal/PlainTime.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp | 4 ++-- .../LibJS/Runtime/Temporal/TimeZonePrototype.cpp | 4 ++-- .../Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index ffc8e13f11..b564c4179e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -390,7 +390,7 @@ ThrowCompletionOr to_seconds_string_precision(VM& vm, Ob // a. If fractionalDigitsVal is not undefined, then if (!fractional_digits_value.is_undefined()) { // i. If ? ToString(fractionalDigitsVal) is not "auto", throw a RangeError exception. - if (TRY(fractional_digits_value.to_deprecated_string(vm)) != "auto"sv) + if (TRY(fractional_digits_value.to_string(vm)) != "auto"sv) return vm.template throw_completion(ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); } @@ -690,7 +690,7 @@ ThrowCompletionOr to_relative_temporal_object(VM& vm, Object const& optio if (offset_behavior == OffsetBehavior::Option) { // a. Set offsetString to ? ToString(offsetString). // NOTE: offsetString is not used after this path, so we don't need to put this into the original offset_string which is of type JS::Value. - auto actual_offset_string = TRY(offset_string.to_deprecated_string(vm)); + auto actual_offset_string = TRY(offset_string.to_string(vm)); // b. If IsTimeZoneOffsetString(offsetString) is false, throw a RangeError exception. if (!is_time_zone_offset_string(actual_offset_string)) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index c390fc3d1e..9fc88f1854 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -389,7 +389,7 @@ ThrowCompletionOr calendar_era(VM& vm, Object& calendar, Object& date_lik // 3. If result is not undefined, set result to ? ToString(result). if (!result.is_undefined()) - result = PrimitiveString::create(vm, TRY(result.to_deprecated_string(vm))); + result = PrimitiveString::create(vm, TRY(result.to_string(vm))); // 4. Return result. return result; @@ -609,10 +609,10 @@ ThrowCompletionOr calendar_equals(VM& vm, Object& one, Object& two) return true; // 2. Let calendarOne be ? ToString(one). - auto calendar_one = TRY(Value(&one).to_deprecated_string(vm)); + auto calendar_one = TRY(Value(&one).to_string(vm)); // 3. Let calendarTwo be ? ToString(two). - auto calendar_two = TRY(Value(&two).to_deprecated_string(vm)); + auto calendar_two = TRY(Value(&two).to_string(vm)); // 4. If calendarOne is calendarTwo, return true. if (calendar_one == calendar_two) @@ -630,10 +630,10 @@ ThrowCompletionOr consolidate_calendars(VM& vm, Object& one, Object& tw return &two; // 2. Let calendarOne be ? ToString(one). - auto calendar_one = TRY(Value(&one).to_deprecated_string(vm)); + auto calendar_one = TRY(Value(&one).to_string(vm)); // 3. Let calendarTwo be ? ToString(two). - auto calendar_two = TRY(Value(&two).to_deprecated_string(vm)); + auto calendar_two = TRY(Value(&two).to_string(vm)); // 4. If calendarOne is calendarTwo, return two. if (calendar_one == calendar_two) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index 1e6ffc9493..f61080c684 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -627,7 +627,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_json) auto* calendar = TRY(typed_this_object(vm)); // 3. Return ? ToString(calendar). - return PrimitiveString::create(vm, TRY(Value(calendar).to_deprecated_string(vm))); + return PrimitiveString::create(vm, TRY(Value(calendar).to_string(vm))); } // 15.6.2.6 Temporal.Calendar.prototype.era ( temporalDateLike ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.era diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp index 7d5f7d0bba..52d666e8d5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp @@ -122,7 +122,7 @@ ThrowCompletionOr to_temporal_time(VM& vm, Value item, Optional(ErrorType::TemporalInvalidCalendarIdentifier, calendar_identifier); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp index 954695a501..75f24bb54a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp @@ -563,10 +563,10 @@ ThrowCompletionOr time_zone_equals(VM& vm, Object& one, Object& two) return true; // 2. Let timeZoneOne be ? ToString(one). - auto time_zone_one = TRY(Value(&one).to_deprecated_string(vm)); + auto time_zone_one = TRY(Value(&one).to_string(vm)); // 3. Let timeZoneTwo be ? ToString(two). - auto time_zone_two = TRY(Value(&two).to_deprecated_string(vm)); + auto time_zone_two = TRY(Value(&two).to_string(vm)); // 4. If timeZoneOne is timeZoneTwo, return true. if (time_zone_one == time_zone_two) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index 13a6462325..c74b02b187 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022, Linus Groh + * Copyright (c) 2021-2023, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -244,7 +244,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_json) auto* time_zone = TRY(typed_this_object(vm)); // 3. Return ? ToString(timeZone). - return PrimitiveString::create(vm, TRY(Value(time_zone).to_deprecated_string(vm))); + return PrimitiveString::create(vm, TRY(Value(time_zone).to_string(vm))); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index ac25bb0276..3bc753fba4 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -340,7 +340,7 @@ ThrowCompletionOr temporal_zoned_date_time_to_string(VM& vm, ZonedDateTi // 13. Else, else { // a. Let timeZoneID be ? ToString(timeZone). - auto time_zone_id = TRY(Value(&time_zone).to_deprecated_string(vm)); + auto time_zone_id = TRY(Value(&time_zone).to_string(vm)); // b. If showTimeZone is "critical", let flag be "!"; else let flag be the empty String. auto flag = show_time_zone == "critical"sv ? "!"sv : ""sv;