From 57162ad510b7e03137f9c6bf00b49252604c01d5 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 17 Oct 2022 09:11:32 +0200 Subject: [PATCH] LibJS: Rename IsValidTimeZoneName to IsAvailableTimeZoneName This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/873313b --- .../LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp | 4 ++-- .../LibJS/Runtime/Temporal/AbstractOperations.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp | 8 ++++---- Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h | 2 +- .../LibJS/Runtime/Temporal/TimeZoneConstructor.cpp | 4 ++-- .../Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp index 41e38203f9..f9d0fb1aa8 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp @@ -224,8 +224,8 @@ ThrowCompletionOr initialize_date_time_format(VM& vm, DateTimeF // a. Set timeZone to ? ToString(timeZone). time_zone = TRY(time_zone_value.to_string(vm)); - // b. If the result of IsValidTimeZoneName(timeZone) is false, then - if (!Temporal::is_valid_time_zone_name(time_zone)) { + // b. If IsAvailableTimeZoneName(timeZone) is false, then + if (!Temporal::is_available_time_zone_name(time_zone)) { // i. Throw a RangeError exception. return vm.throw_completion(ErrorType::OptionIsNotValidValue, time_zone, vm.names.timeZone); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 5e9d4b524f..d8d11e1103 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -631,8 +631,8 @@ ThrowCompletionOr to_relative_temporal_object(VM& vm, Object const& optio else { // i. If IsTimeZoneOffsetString(timeZoneName) is false, then if (!is_time_zone_offset_string(*time_zone_name)) { - // 1. If IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception. - if (!is_valid_time_zone_name(*time_zone_name)) + // 1. If IsAvailableTimeZoneName(timeZoneName) is false, throw a RangeError exception. + if (!is_available_time_zone_name(*time_zone_name)) return vm.throw_completion(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); // 2. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp index 4146674ca7..9c7313bd10 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp @@ -27,8 +27,8 @@ TimeZone::TimeZone(Object& prototype) { } -// 11.1.1 IsValidTimeZoneName ( timeZone ), https://tc39.es/proposal-temporal/#sec-isvalidtimezonename -bool is_valid_time_zone_name(StringView time_zone) +// 11.1.1 IsAvailableTimeZoneName ( timeZone ), https://tc39.es/proposal-temporal/#sec-isavailabletimezonename +bool is_available_time_zone_name(StringView time_zone) { // 1. Let timeZones be AvailableTimeZones(). // 2. For each String candidate in timeZones, do @@ -331,8 +331,8 @@ ThrowCompletionOr to_temporal_time_zone(VM& vm, Value temporal_time_zon // b. If IsTimeZoneOffsetString(name) is false, then if (!is_time_zone_offset_string(name)) { - // i. If IsValidTimeZoneName(name) is false, throw a RangeError exception. - if (!is_valid_time_zone_name(name)) + // i. If IsAvailableTimeZoneName(name) is false, throw a RangeError exception. + if (!is_available_time_zone_name(name)) return vm.throw_completion(ErrorType::TemporalInvalidTimeZoneName, name); // ii. Set name to ! CanonicalizeTimeZoneName(name). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h index 36c2efda4a..dc20ea26eb 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h @@ -36,7 +36,7 @@ private: Optional m_offset_nanoseconds; // [[OffsetNanoseconds]] }; -bool is_valid_time_zone_name(StringView time_zone); +bool is_available_time_zone_name(StringView time_zone); String canonicalize_time_zone_name(String const& time_zone); ThrowCompletionOr create_temporal_time_zone(VM&, String const& identifier, FunctionObject const* new_target = nullptr); ISODateTime get_iso_parts_from_epoch(VM&, Crypto::SignedBigInteger const& epoch_nanoseconds); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp index 7597417692..0eaeb120cf 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp @@ -52,8 +52,8 @@ ThrowCompletionOr TimeZoneConstructor::construct(FunctionObject& new_ta // 3. If IsTimeZoneOffsetString(identifier) is false, then if (!is_time_zone_offset_string(identifier)) { - // a. If IsValidTimeZoneName(identifier) is false, then - if (!is_valid_time_zone_name(identifier)) { + // a. If IsAvailableTimeZoneName(identifier) is false, then + if (!is_available_time_zone_name(identifier)) { // i. Throw a RangeError exception. return vm.throw_completion(ErrorType::TemporalInvalidTimeZoneName, identifier); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index 3e6b4a4256..4507b78ecc 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -199,8 +199,8 @@ ThrowCompletionOr to_temporal_zoned_date_time(VM& vm, Value item // f. If IsTimeZoneOffsetString(timeZoneName) is false, then if (!is_time_zone_offset_string(*time_zone_name)) { - // i. If IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception. - if (!is_valid_time_zone_name(*time_zone_name)) + // i. If IsAvailableTimeZoneName(timeZoneName) is false, throw a RangeError exception. + if (!is_available_time_zone_name(*time_zone_name)) return vm.throw_completion(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); // ii. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName).