From 6d7970a23ccb37a1f71773cdf63bde6d5882b228 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 16 May 2022 20:33:22 +0100 Subject: [PATCH] LibJS: Remove unnecessary CalendarDate production This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/48744ea --- .../LibJS/Runtime/Temporal/AbstractOperations.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 1f09ea6eb2..a4d8ad4765 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -1554,27 +1554,25 @@ ThrowCompletionOr parse_temporal_time_string(GlobalObject& global_ // 1. Assert: Type(isoString) is String. - // 2. If isoString does not satisfy the syntax of a TemporalTimeString (see 13.33), then + // 2. Let parseResult be ParseText(StringToCodePoints(isoString), TemporalTimeString). auto parse_result = parse_iso8601(Production::TemporalTimeString, iso_string); + + // 3. If parseResult is a List of errors, then if (!parse_result.has_value()) { // a. Throw a RangeError exception. return vm.throw_completion(global_object, ErrorType::TemporalInvalidTimeString, iso_string); } - // 3. If isoString contains a UTCDesignator, then + // 4. If parseResult contains a UTCDesignator, then if (parse_result->utc_designator.has_value()) { // a. Throw a RangeError exception. return vm.throw_completion(global_object, ErrorType::TemporalInvalidTimeStringUTCDesignator, iso_string); } - // 4. Let result be ? ParseISODateTime(isoString). + // 5. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); - // 5. Assert: ParseText(StringToCodePoints(isoString), CalendarDate) is a List of errors. - // 6. Assert: ParseText(StringToCodePoints(isoString), DateSpecYearMonth) is a List of errors. - // 7. Assert: ParseText(StringToCodePoints(isoString), DateSpecMonthDay) is a List of errors. - - // 8. Return the Record { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }. + // 6. Return the Record { [[Hour]]: result.[[Hour]], [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], [[Calendar]]: result.[[Calendar]] }. return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) }; }