Skip to content

Commit

Permalink
Bug 1920955 - Part 1: Ensure date-time separators are consistent. r=s…
Browse files Browse the repository at this point in the history
…fink

Request for test262 coverage: tc39/test262#4237

Differential Revision: https://phabricator.services.mozilla.com/D223506

UltraBlame original commit: 75430ad783acfc49e5aaca4178f7359695cf47e5
  • Loading branch information
marco-c committed Oct 9, 2024
1 parent 7b21bb1 commit f92eaee
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 14 deletions.
32 changes: 32 additions & 0 deletions js/public/friend/ErrorNumbers.msg
Original file line number Diff line number Diff line change
Expand Up @@ -14668,6 +14668,38 @@ seconds
precision
"
)
MSG_DEF
(
JSMSG_TEMPORAL_PARSER_INCONSISTENT_DATE_SEPARATOR
0
JSEXN_RANGEERR
"
date
separator
'
-
'
must
be
consistent
"
)
MSG_DEF
(
JSMSG_TEMPORAL_PARSER_INCONSISTENT_TIME_SEPARATOR
0
JSEXN_RANGEERR
"
time
separator
'
:
'
must
be
consistent
"
)
/
/
Explicit
Expand Down
106 changes: 92 additions & 14 deletions js/src/builtin/temporal/TemporalParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6114,6 +6114,9 @@ JSMSG_TEMPORAL_PARSER_MISSING_YEAR
Optional
:
-
bool
hasMonthSeparator
=
character
(
'
Expand Down Expand Up @@ -6202,6 +6205,9 @@ JSMSG_TEMPORAL_PARSER_MISSING_MONTH
Optional
:
-
bool
hasDaySeparator
=
character
(
'
Expand All @@ -6211,6 +6217,32 @@ character
;
/
/
Date
separators
must
be
consistent
.
if
(
hasMonthSeparator
!
=
hasDaySeparator
)
{
return
mozilla
:
:
Err
(
JSMSG_TEMPORAL_PARSER_INCONSISTENT_DATE_SEPARATOR
)
;
}
/
/
DateDay
:
:
Expand Down Expand Up @@ -6457,7 +6489,7 @@ Optional
:
:
bool
needsMinutes
hasMinuteSeparator
=
character
(
Expand Down Expand Up @@ -6557,11 +6589,8 @@ Optional
:
:
bool
needsSeconds
hasSecondSeparator
=
needsMinutes
&
&
character
(
'
Expand Down Expand Up @@ -6627,6 +6656,32 @@ JSMSG_TEMPORAL_PARSER_INVALID_LEAPSECOND
}
/
/
Time
separators
must
be
consistent
.
if
(
hasMinuteSeparator
!
=
hasSecondSeparator
)
{
return
mozilla
:
:
Err
(
JSMSG_TEMPORAL_PARSER_INCONSISTENT_TIME_SEPARATOR
)
;
}
/
/
TimeFraction
:
:
Expand Down Expand Up @@ -6698,7 +6753,7 @@ fractionalPart
else
if
(
needsSeconds
hasSecondSeparator
)
{
return
Expand All @@ -6715,7 +6770,7 @@ JSMSG_TEMPORAL_PARSER_MISSING_SECOND
else
if
(
needsMinutes
hasMinuteSeparator
)
{
return
Expand Down Expand Up @@ -7431,7 +7486,7 @@ Extended
empty
]
bool
needsMinutes
hasMinuteSeparator
=
character
(
Expand Down Expand Up @@ -7540,11 +7595,8 @@ Extended
empty
]
bool
needsSeconds
hasSecondSeparator
=
needsMinutes
&
&
character
(
'
Expand Down Expand Up @@ -7626,6 +7678,32 @@ JSMSG_TEMPORAL_PARSER_INVALID_SECOND
)
;
}
/
/
Time
separators
must
be
consistent
.
if
(
hasMinuteSeparator
!
=
hasSecondSeparator
)
{
return
mozilla
:
:
Err
(
JSMSG_TEMPORAL_PARSER_INCONSISTENT_TIME_SEPARATOR
)
;
}
if
(
auto
Expand Down Expand Up @@ -7657,7 +7735,7 @@ true
else
if
(
needsSeconds
hasSecondSeparator
)
{
return
Expand All @@ -7674,7 +7752,7 @@ JSMSG_TEMPORAL_PARSER_MISSING_SECOND
else
if
(
needsMinutes
hasMinuteSeparator
)
{
return
Expand Down

0 comments on commit f92eaee

Please sign in to comment.