mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibJS: Rename ToShowCalendarOption to ToCalendarNameOption
This is an editorial change in the Temporal spec.
See: 2c9e2615f7
This commit is contained in:
parent
71359ee453
commit
efe82e5c91
Notes:
sideshowbarker
2024-07-17 04:47:47 +09:00
Author: https://github.com/Smrtnyk
Commit: efe82e5c91
Pull-request: https://github.com/SerenityOS/serenity/pull/15925
Reviewed-by: https://github.com/davidot ✅
7 changed files with 13 additions and 13 deletions
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue