From 9b3602d0007f436f9b78b4cb2b4678ddc8138429 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 14 Jun 2022 23:32:13 +0100 Subject: [PATCH] LibJS: Update missing/superfluous commas in various spec comments These are editorial changes in the Temporal spec. See: - https://github.com/tc39/proposal-temporal/commit/9586746 - https://github.com/tc39/proposal-temporal/commit/3c76ecc - https://github.com/tc39/proposal-temporal/commit/96eab07 --- .../LibJS/Runtime/Temporal/AbstractOperations.cpp | 2 +- .../LibJS/Runtime/Temporal/AbstractOperations.h | 2 +- .../Libraries/LibJS/Runtime/Temporal/Calendar.cpp | 2 +- .../LibJS/Runtime/Temporal/CalendarPrototype.cpp | 12 ++++++------ .../LibJS/Runtime/Temporal/ZonedDateTime.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 4302c9a58b..248998b5fa 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -835,7 +835,7 @@ ThrowCompletionOr reject_object_with_calendar_or_time_zone(GlobalObject& g // 13.21 FormatSecondsStringPart ( second, millisecond, microsecond, nanosecond, precision ), https://tc39.es/proposal-temporal/#sec-temporal-formatsecondsstringpart String format_seconds_string_part(u8 second, u16 millisecond, u16 microsecond, u16 nanosecond, Variant const& precision) { - // 1. Assert: second, millisecond, microsecond and nanosecond are integers. + // 1. Assert: second, millisecond, microsecond, and nanosecond are integers. // Non-standard sanity check if (precision.has()) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index a2bd765012..866ab53d8e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -204,7 +204,7 @@ ThrowCompletionOr to_integer_without_rounding(GlobalObject& global_objec // 1. Let number be ? ToNumber(argument). auto number = TRY(argument.to_number(global_object)); - // 2. If number is NaN, +0𝔽, or -0𝔽 return 0. + // 2. If number is NaN, +0𝔽, or -0𝔽, return 0. if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero()) return 0; diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 0779cd41a4..bce28d0f95 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -707,7 +707,7 @@ ThrowCompletionOr resolve_iso_month(GlobalObject& global_object, Object if (number_part_integer < 1 || number_part_integer > 12) return vm.throw_completion(global_object, ErrorType::TemporalInvalidMonthCode); - // 11. If month is not undefined, and month ≠ numberPart, then + // 11. If month is not undefined and month ≠ numberPart, then if (!month.is_undefined() && month.as_double() != number_part_integer) { // a. Throw a RangeError exception. return vm.throw_completion(global_object, ErrorType::TemporalInvalidMonthCode); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index abcb56e3bd..b0b09084f9 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -231,7 +231,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year) VERIFY(calendar->identifier() == "iso8601"sv); auto temporal_date_like = vm.argument(0); - // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slot, then + // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). temporal_date_like = TRY(to_temporal_date(global_object, temporal_date_like)); @@ -260,7 +260,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month) return vm.throw_completion(global_object, ErrorType::TemporalAmbiguousMonthOfPlainMonthDay); } - // 5. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slot, then + // 5. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). temporal_date_like = TRY(to_temporal_date(global_object, temporal_date_like)); @@ -417,7 +417,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_month) VERIFY(calendar->identifier() == "iso8601"sv); auto temporal_date_like = vm.argument(0); - // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slots, then + // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slots, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). temporal_date_like = TRY(to_temporal_date(global_object, temporal_date_like)); @@ -439,7 +439,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::days_in_year) VERIFY(calendar->identifier() == "iso8601"sv); auto temporal_date_like = vm.argument(0); - // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slot, then + // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). temporal_date_like = TRY(to_temporal_date(global_object, temporal_date_like)); @@ -461,7 +461,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::months_in_year) VERIFY(calendar->identifier() == "iso8601"sv); auto temporal_date_like = vm.argument(0); - // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slot, then + // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Perform ? ToTemporalDate(temporalDateLike). (void)TRY(to_temporal_date(global_object, temporal_date_like)); @@ -483,7 +483,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::in_leap_year) VERIFY(calendar->identifier() == "iso8601"sv); auto temporal_date_like = vm.argument(0); - // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]] or [[InitializedTemporalYearMonth]] internal slot, then + // 4. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then if (!temporal_date_like.is_object() || !(is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()) || is(temporal_date_like.as_object()))) { // a. Set temporalDateLike to ? ToTemporalDate(temporalDateLike). temporal_date_like = TRY(to_temporal_date(global_object, temporal_date_like)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index bb91716110..7ba66c1c3f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -48,7 +48,7 @@ ThrowCompletionOr interpret_iso_date_time_offset(GlobalObject& gl // 2. Let dateTime be ? CreateTemporalDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar). auto* date_time = TRY(create_temporal_date_time(global_object, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, *calendar)); - // 3. If offsetBehaviour is wall, or offsetOption is "ignore", then + // 3. If offsetBehaviour is wall or offsetOption is "ignore", then if (offset_behavior == OffsetBehavior::Wall || offset_option == "ignore"sv) { // a. Let instant be ? BuiltinTimeZoneGetInstantFor(timeZone, dateTime, disambiguation). auto* instant = TRY(builtin_time_zone_get_instant_for(global_object, time_zone, *date_time, disambiguation)); @@ -57,7 +57,7 @@ ThrowCompletionOr interpret_iso_date_time_offset(GlobalObject& gl return &instant->nanoseconds(); } - // 4. If offsetBehaviour is exact, or offsetOption is "use", then + // 4. If offsetBehaviour is exact or offsetOption is "use", then if (offset_behavior == OffsetBehavior::Exact || offset_option == "use"sv) { // a. Let epochNanoseconds be GetEpochFromISOParts(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond). auto* epoch_nanoseconds = get_epoch_from_iso_parts(global_object, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);