mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 18:19:03 +00:00
LibJS: Reject ambiguous annotated time strings
This missing rejection will be caught by an upcoming Temporal.PlainTime test.
This commit is contained in:
parent
c83a3db542
commit
0b59971ef9
Notes:
github-actions[bot]
2024-11-24 00:38:22 +00:00
Author: https://github.com/trflynn89
Commit: 0b59971ef9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2535
2 changed files with 13 additions and 2 deletions
|
@ -1017,7 +1017,9 @@ ThrowCompletionOr<ParsedISODateTime> parse_iso_date_time(VM& vm, StringView iso_
|
|||
// 4. If goal is TemporalMonthDayString and parseResult does not contain a DateYear Parse Node, then
|
||||
if (goal == Production::TemporalMonthDayString && !parse_result->date_year.has_value()) {
|
||||
// a. Assert: goal is the last element of allowedFormats.
|
||||
VERIFY(goal == allowed_formats.last());
|
||||
// FIXME: Spec issue: This assertion is possibly incorrect.
|
||||
// https://github.com/tc39/proposal-temporal/issues/3045
|
||||
// VERIFY(goal == allowed_formats.last());
|
||||
|
||||
// b. Set yearAbsent to true.
|
||||
year_absent = true;
|
||||
|
|
|
@ -199,7 +199,16 @@ public:
|
|||
// AnnotatedTime :::
|
||||
// TimeDesignator Time DateTimeUTCOffset[~Z][opt] TimeZoneAnnotation[opt] Annotations[opt]
|
||||
// Time DateTimeUTCOffset[~Z][opt] TimeZoneAnnotation[opt] Annotations[opt]
|
||||
(void)parse_time_designator();
|
||||
auto has_time_designator = parse_time_designator();
|
||||
|
||||
if (!has_time_designator) {
|
||||
StateTransaction transaction { *this };
|
||||
|
||||
// It is a Syntax Error if ParseText(Time DateTimeUTCOffset[~Z], DateSpecMonthDay) is a Parse Node.
|
||||
// It is a Syntax Error if ParseText(Time DateTimeUTCOffset[~Z], DateSpecYearMonth) is a Parse Node.
|
||||
if (parse_date_spec_month_day() || parse_date_spec_year_month())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_time())
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue