From 28ee331a93681d10415822398d16e3b17c3bdf96 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 26 Jan 2023 15:46:03 +0000 Subject: [PATCH] LibJS: Make parse_temporal_instant() take a StringView The underlying parse_temporal_instant_string() function already does this as well. --- Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Temporal/Instant.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 44c2e750b0..75f008448b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -100,7 +100,7 @@ ThrowCompletionOr to_temporal_instant(VM& vm, Value item) } // 2. Let string be ? ToString(item). - auto string = TRY(item.to_deprecated_string(vm)); + auto string = TRY(item.to_string(vm)); // 3. Let epochNanoseconds be ? ParseTemporalInstant(string). auto* epoch_nanoseconds = TRY(parse_temporal_instant(vm, string)); @@ -110,7 +110,7 @@ ThrowCompletionOr to_temporal_instant(VM& vm, Value item) } // 8.5.4 ParseTemporalInstant ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalinstant -ThrowCompletionOr parse_temporal_instant(VM& vm, DeprecatedString const& iso_string) +ThrowCompletionOr parse_temporal_instant(VM& vm, StringView iso_string) { // 1. Assert: Type(isoString) is String. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h index ba8e15dfe8..0118086808 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h @@ -45,7 +45,7 @@ bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds); bool is_valid_epoch_nanoseconds(Crypto::SignedBigInteger const& epoch_nanoseconds); ThrowCompletionOr create_temporal_instant(VM&, BigInt const& nanoseconds, FunctionObject const* new_target = nullptr); ThrowCompletionOr to_temporal_instant(VM&, Value item); -ThrowCompletionOr parse_temporal_instant(VM&, DeprecatedString const& iso_string); +ThrowCompletionOr parse_temporal_instant(VM&, StringView iso_string); i32 compare_epoch_nanoseconds(BigInt const&, BigInt const&); ThrowCompletionOr add_instant(VM&, BigInt const& epoch_nanoseconds, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds); BigInt* difference_instant(VM&, BigInt const& nanoseconds1, BigInt const& nanoseconds2, u64 rounding_increment, StringView smallest_unit, StringView rounding_mode);