浏览代码

LibJS: Rename ToShowCalendarOption to ToCalendarNameOption

This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2c9e2615f74a5ff15a812dac5cc2c3fa0c4a5922
Smrtnyk 2 年之前
父节点
当前提交
efe82e5c91

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp

@@ -243,8 +243,8 @@ ThrowCompletionOr<String> to_temporal_offset(VM& vm, Object const* options, Stri
     return option.as_string().string();
 }
 
-// 13.9 ToShowCalendarOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowcalendaroption
-ThrowCompletionOr<String> to_show_calendar_option(VM& vm, Object const& normalized_options)
+// 13.9 ToCalendarNameOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-tocalendarnameoption
+ThrowCompletionOr<String> to_calendar_name_option(VM& vm, Object const& normalized_options)
 {
     // 1. Return ? GetOption(normalizedOptions, "calendarName", "string", « "auto", "always", "never", "critical" », "auto").
     auto option = TRY(get_option(vm, normalized_options, vm.names.calendarName, OptionType::String, { "auto"sv, "always"sv, "never"sv, "critical"sv }, "auto"sv));

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h

@@ -140,7 +140,7 @@ ThrowCompletionOr<String> to_temporal_disambiguation(VM&, Object const* options)
 ThrowCompletionOr<String> to_temporal_rounding_mode(VM&, Object const& normalized_options, String const& fallback);
 StringView negate_temporal_rounding_mode(String const& rounding_mode);
 ThrowCompletionOr<String> to_temporal_offset(VM&, Object const* options, String const& fallback);
-ThrowCompletionOr<String> to_show_calendar_option(VM&, Object const& normalized_options);
+ThrowCompletionOr<String> to_calendar_name_option(VM&, Object const& normalized_options);
 ThrowCompletionOr<String> to_show_time_zone_name_option(VM&, Object const& normalized_options);
 ThrowCompletionOr<String> to_show_offset_option(VM&, Object const& normalized_options);
 ThrowCompletionOr<u64> to_temporal_rounding_increment(VM&, Object const& normalized_options, Optional<double> dividend, bool inclusive);

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp

@@ -595,8 +595,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_string)
     // 3. Set options to ? GetOptionsObject(options).
     auto* options = TRY(get_options_object(vm, vm.argument(0)));
 
-    // 4. Let showCalendar be ? ToShowCalendarOption(options).
-    auto show_calendar = TRY(to_show_calendar_option(vm, *options));
+    // 4. Let showCalendar be ? ToCalendarNameOption(options).
+    auto show_calendar = TRY(to_calendar_name_option(vm, *options));
 
     // 5. Return ? TemporalDateToString(temporalDate, showCalendar).
     return js_string(vm, TRY(temporal_date_to_string(vm, *temporal_date, show_calendar)));

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp

@@ -600,8 +600,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_string)
     // 5. Let roundingMode be ? ToTemporalRoundingMode(options, "trunc").
     auto rounding_mode = TRY(to_temporal_rounding_mode(vm, *options, "trunc"sv));
 
-    // 6. Let showCalendar be ? ToShowCalendarOption(options).
-    auto show_calendar = TRY(to_show_calendar_option(vm, *options));
+    // 6. Let showCalendar be ? ToCalendarNameOption(options).
+    auto show_calendar = TRY(to_calendar_name_option(vm, *options));
 
     // 7. Let result be ! RoundISODateTime(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]], precision.[[Increment]], precision.[[Unit]], roundingMode).
     auto result = round_iso_date_time(date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond(), precision.increment, precision.unit, rounding_mode);

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp

@@ -162,8 +162,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_string)
     // 3. Set options to ? GetOptionsObject(options).
     auto* options = TRY(get_options_object(vm, vm.argument(0)));
 
-    // 4. Let showCalendar be ? ToShowCalendarOption(options).
-    auto show_calendar = TRY(to_show_calendar_option(vm, *options));
+    // 4. Let showCalendar be ? ToCalendarNameOption(options).
+    auto show_calendar = TRY(to_calendar_name_option(vm, *options));
 
     // 5. Return ? TemporalMonthDayToString(monthDay, showCalendar).
     return js_string(vm, TRY(temporal_month_day_to_string(vm, *month_day, show_calendar)));

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp

@@ -329,8 +329,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_string)
     // 3. Set options to ? GetOptionsObject(options).
     auto* options = TRY(get_options_object(vm, vm.argument(0)));
 
-    // 4. Let showCalendar be ? ToShowCalendarOption(options).
-    auto show_calendar = TRY(to_show_calendar_option(vm, *options));
+    // 4. Let showCalendar be ? ToCalendarNameOption(options).
+    auto show_calendar = TRY(to_calendar_name_option(vm, *options));
 
     // 5. Return ? TemporalYearMonthToString(yearMonth, showCalendar).
     return js_string(vm, TRY(temporal_year_month_to_string(vm, *year_month, show_calendar)));

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp

@@ -1083,8 +1083,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_string)
     // 5. Let roundingMode be ? ToTemporalRoundingMode(options, "trunc").
     auto rounding_mode = TRY(to_temporal_rounding_mode(vm, *options, "trunc"));
 
-    // 6. Let showCalendar be ? ToShowCalendarOption(options).
-    auto show_calendar = TRY(to_show_calendar_option(vm, *options));
+    // 6. Let showCalendar be ? ToCalendarNameOption(options).
+    auto show_calendar = TRY(to_calendar_name_option(vm, *options));
 
     // 7. Let showTimeZone be ? ToShowTimeZoneNameOption(options).
     auto show_time_zone = TRY(to_show_time_zone_name_option(vm, *options));