瀏覽代碼

LibJS: Combine TemporalTimeZoneIdentifier and TimeZoneBracketedName

This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6db76f4
Linus Groh 3 年之前
父節點
當前提交
0946f82c8c

+ 7 - 17
Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.cpp

@@ -950,10 +950,10 @@ bool ISO8601Parser::parse_time_zone_iana_name()
     return true;
 }
 
-// https://tc39.es/proposal-temporal/#prod-TimeZoneBracketedName
-bool ISO8601Parser::parse_time_zone_bracketed_name()
+// https://tc39.es/proposal-temporal/#prod-TimeZoneIdentifier
+bool ISO8601Parser::parse_time_zone_identifier()
 {
-    // TimeZoneBracketedName :
+    // TimeZoneIdentifier :
     //     TimeZoneIANAName
     //     TimeZoneUTCOffsetName
     StateTransaction transaction { *this };
@@ -970,11 +970,11 @@ bool ISO8601Parser::parse_time_zone_bracketed_name()
 bool ISO8601Parser::parse_time_zone_bracketed_annotation()
 {
     // TimeZoneBracketedAnnotation :
-    //     [ TimeZoneBracketedName ]
+    //     [ TimeZoneIdentifier ]
     StateTransaction transaction { *this };
     if (!m_state.lexer.consume_specific('['))
         return false;
-    if (!parse_time_zone_bracketed_name())
+    if (!parse_time_zone_identifier())
         return false;
     if (!m_state.lexer.consume_specific(']'))
         return false;
@@ -1650,24 +1650,14 @@ bool ISO8601Parser::parse_temporal_time_string()
         || parse_calendar_time();
 }
 
-// https://tc39.es/proposal-temporal/#prod-TemporalTimeZoneIdentifier
-bool ISO8601Parser::parse_temporal_time_zone_identifier()
-{
-    // TemporalTimeZoneIdentifier :
-    //     TimeZoneNumericUTCOffset
-    //     TimeZoneIANAName
-    return parse_time_zone_numeric_utc_offset()
-        || parse_time_zone_iana_name();
-}
-
 // https://tc39.es/proposal-temporal/#prod-TemporalTimeZoneString
 bool ISO8601Parser::parse_temporal_time_zone_string()
 {
     // TemporalTimeZoneString :
-    //     TemporalTimeZoneIdentifier
+    //     TimeZoneIdentifier
     //     Date TimeSpecSeparator[opt] TimeZone Calendar[opt]
     StateTransaction transaction { *this };
-    if (!parse_temporal_time_zone_identifier()) {
+    if (!parse_time_zone_identifier()) {
         if (!parse_date())
             return false;
         (void)parse_time_spec_separator();

+ 1 - 2
Userland/Libraries/LibJS/Runtime/Temporal/ISO8601.h

@@ -136,7 +136,7 @@ public:
     [[nodiscard]] bool parse_time_zone_iana_component();
     [[nodiscard]] bool parse_time_zone_iana_name_tail();
     [[nodiscard]] bool parse_time_zone_iana_name();
-    [[nodiscard]] bool parse_time_zone_bracketed_name();
+    [[nodiscard]] bool parse_time_zone_identifier();
     [[nodiscard]] bool parse_time_zone_bracketed_annotation();
     [[nodiscard]] bool parse_time_zone_offset_required();
     [[nodiscard]] bool parse_time_zone_name_required();
@@ -176,7 +176,6 @@ public:
     [[nodiscard]] bool parse_temporal_duration_string();
     [[nodiscard]] bool parse_temporal_month_day_string();
     [[nodiscard]] bool parse_temporal_time_string();
-    [[nodiscard]] bool parse_temporal_time_zone_identifier();
     [[nodiscard]] bool parse_temporal_time_zone_string();
     [[nodiscard]] bool parse_temporal_year_month_string();
     [[nodiscard]] bool parse_temporal_zoned_date_time_string();