diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index c8e418a0c1..f5f6a7be38 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -458,69 +458,60 @@ ThrowCompletionOr get_temporal_calendar_with_iso_default(GlobalObject& return to_temporal_calendar_with_iso_default(global_object, calendar_like); } -// 12.1.24 DateFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-datefromfields -ThrowCompletionOr date_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) +// 12.1.24 CalendarDateFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-calendardatefromfields +ThrowCompletionOr calendar_date_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) { auto& vm = global_object.vm(); - // 1. Assert: Type(calendar) is Object. - // 2. Assert: Type(fields) is Object. - // 3. If options is not present, set options to undefined. - // 4. Assert: Type(options) is Object or Undefined. + // 1. If options is not present, set options to undefined. - // 5. Let date be ? Invoke(calendar, "dateFromFields", « fields, options »). + // 2. Let date be ? Invoke(calendar, "dateFromFields", « fields, options »). auto date = TRY(Value(&calendar).invoke(global_object, vm.names.dateFromFields, &fields, options ?: js_undefined())); - // 6. Perform ? RequireInternalSlot(date, [[InitializedTemporalDate]]). + // 3. Perform ? RequireInternalSlot(date, [[InitializedTemporalDate]]). auto* date_object = TRY(date.to_object(global_object)); if (!is(date_object)) return vm.throw_completion(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); - // 7. Return date. + // 4. Return date. return static_cast(date_object); } -// 12.1.25 YearMonthFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-yearmonthfromfields -ThrowCompletionOr year_month_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) +// 12.1.25 CalendarYearMonthFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-calendaryearmonthfromfields +ThrowCompletionOr calendar_year_month_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) { auto& vm = global_object.vm(); - // 1. Assert: Type(calendar) is Object. - // 2. Assert: Type(fields) is Object. - // 3. If options is not present, set options to undefined. - // 4. Assert: Type(options) is Object or Undefined. + // 1. If options is not present, set options to undefined. - // 5. Let yearMonth be ? Invoke(calendar, "yearMonthFromFields", « fields, options »). + // 2. Let yearMonth be ? Invoke(calendar, "yearMonthFromFields", « fields, options »). auto year_month = TRY(Value(&calendar).invoke(global_object, vm.names.yearMonthFromFields, &fields, options ?: js_undefined())); - // 6. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). + // 3. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). auto* year_month_object = TRY(year_month.to_object(global_object)); if (!is(year_month_object)) return vm.throw_completion(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth"); - // 7. Return yearMonth. + // 4. Return yearMonth. return static_cast(year_month_object); } -// 12.1.26 MonthDayFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-monthdayfromfields -ThrowCompletionOr month_day_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) +// 12.1.26 CalendarMonthDayFromFields ( calendar, fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-calendarmonthdayfromfields +ThrowCompletionOr calendar_month_day_from_fields(GlobalObject& global_object, Object& calendar, Object const& fields, Object const* options) { auto& vm = global_object.vm(); - // 1. Assert: Type(calendar) is Object. - // 2. Assert: Type(fields) is Object. - // 3. If options is not present, set options to undefined. - // 4. Assert: Type(options) is Object or Undefined. + // 1. If options is not present, set options to undefined. - // 5. Let monthDay be ? Invoke(calendar, "monthDayFromFields", « fields, options »). + // 2. Let monthDay be ? Invoke(calendar, "monthDayFromFields", « fields, options »). auto month_day = TRY(Value(&calendar).invoke(global_object, vm.names.monthDayFromFields, &fields, options ?: js_undefined())); - // 6. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). + // 3. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). auto* month_day_object = TRY(month_day.to_object(global_object)); if (!is(month_day_object)) return vm.throw_completion(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay"); - // 7. Return monthDay. + // 4. Return monthDay. return static_cast(month_day_object); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h index c0e97915f4..72650952f9 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h @@ -55,9 +55,9 @@ ThrowCompletionOr calendar_era_year(GlobalObject&, Object& calendar, Obje ThrowCompletionOr to_temporal_calendar(GlobalObject&, Value); ThrowCompletionOr to_temporal_calendar_with_iso_default(GlobalObject&, Value); ThrowCompletionOr get_temporal_calendar_with_iso_default(GlobalObject&, Object&); -ThrowCompletionOr date_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); -ThrowCompletionOr year_month_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); -ThrowCompletionOr month_day_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); +ThrowCompletionOr calendar_date_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); +ThrowCompletionOr calendar_year_month_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); +ThrowCompletionOr calendar_month_day_from_fields(GlobalObject&, Object& calendar, Object const& fields, Object const* options = nullptr); String format_calendar_annotation(StringView id, StringView show_calendar); ThrowCompletionOr calendar_equals(GlobalObject&, Object& one, Object& two); ThrowCompletionOr consolidate_calendars(GlobalObject&, Object& one, Object& two); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp index 36bd4ec3db..89e9f86684 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp @@ -115,8 +115,8 @@ ThrowCompletionOr to_temporal_date(GlobalObject& global_object, Valu // f. Let fields be ? PrepareTemporalFields(item, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, item_object, field_names, {})); - // g. Return ? DateFromFields(calendar, fields, options). - return date_from_fields(global_object, *calendar, *fields, options); + // g. Return ? CalendarDateFromFields(calendar, fields, options). + return calendar_date_from_fields(global_object, *calendar, *fields, options); } // 4. Perform ? ToTemporalOverflow(options). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index 9634e62608..ff5abc11d5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -292,8 +292,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_year_month) // 5. Let fields be ? PrepareTemporalFields(temporalDate, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *temporal_date, field_names, {})); - // 6. Return ? YearMonthFromFields(calendar, fields). - return TRY(year_month_from_fields(global_object, calendar, *fields)); + // 6. Return ? CalendarYearMonthFromFields(calendar, fields). + return TRY(calendar_year_month_from_fields(global_object, calendar, *fields)); } // 3.3.17 Temporal.PlainDate.prototype.toPlainMonthDay ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.toplainmonthday @@ -312,8 +312,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_plain_month_day) // 5. Let fields be ? PrepareTemporalFields(temporalDate, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *temporal_date, field_names, {})); - // 6. Return ? MonthDayFromFields(calendar, fields). - return TRY(month_day_from_fields(global_object, calendar, *fields)); + // 6. Return ? CalendarMonthDayFromFields(calendar, fields). + return TRY(calendar_month_day_from_fields(global_object, calendar, *fields)); } // 3.3.18 Temporal.PlainDate.prototype.getISOFields ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.getisofields @@ -418,8 +418,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with) // 11. Set fields to ? PrepareTemporalFields(fields, fieldNames, «»). fields = TRY(prepare_temporal_fields(global_object, *fields, field_names, {})); - // 12. Return ? DateFromFields(calendar, fields, options). - return TRY(date_from_fields(global_object, calendar, *fields, options)); + // 12. Return ? CalendarDateFromFields(calendar, fields, options). + return TRY(calendar_date_from_fields(global_object, calendar, *fields, options)); } // 3.3.22 Temporal.PlainDate.prototype.withCalendar ( calendarLike ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.withcalendar diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp index bd75a4780f..02766e1e5d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp @@ -110,8 +110,8 @@ ThrowCompletionOr interpret_temporal_date_time_fields(GlobalObject& // 2. Let overflow be ? ToTemporalOverflow(options). auto overflow = TRY(to_temporal_overflow(global_object, &options)); - // 3. Let temporalDate be ? DateFromFields(calendar, fields, options). - auto* temporal_date = TRY(date_from_fields(global_object, calendar, fields, &options)); + // 3. Let temporalDate be ? CalendarDateFromFields(calendar, fields, options). + auto* temporal_date = TRY(calendar_date_from_fields(global_object, calendar, fields, &options)); // 4. Let timeResult be ? RegulateTime(timeResult.[[Hour]], timeResult.[[Minute]], timeResult.[[Second]], timeResult.[[Millisecond]], timeResult.[[Microsecond]], timeResult.[[Nanosecond]], overflow). auto time_result = TRY(regulate_time(global_object, unregulated_time_result.hour, unregulated_time_result.minute, unregulated_time_result.second, unregulated_time_result.millisecond, unregulated_time_result.microsecond, unregulated_time_result.nanosecond, overflow)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index 8d2bef5034..f59ce615f5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -802,8 +802,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_year_month) // 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *date_time, field_names, {})); - // 6. Return ? YearMonthFromFields(calendar, fields). - return TRY(year_month_from_fields(global_object, calendar, *fields)); + // 6. Return ? CalendarYearMonthFromFields(calendar, fields). + return TRY(calendar_year_month_from_fields(global_object, calendar, *fields)); } // 5.3.39 Temporal.PlainDateTime.prototype.toPlainMonthDay ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplainmonthday @@ -822,8 +822,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_plain_month_day) // 5. Let fields be ? PrepareTemporalFields(dateTime, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *date_time, field_names, {})); - // 6. Return ? MonthDayFromFields(calendar, fields). - return TRY(month_day_from_fields(global_object, calendar, *fields)); + // 6. Return ? CalendarMonthDayFromFields(calendar, fields). + return TRY(calendar_month_day_from_fields(global_object, calendar, *fields)); } // 5.3.40 Temporal.PlainDateTime.prototype.toPlainTime ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplaintime diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp index 91e2c63e7f..90ae47c92d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp @@ -113,8 +113,8 @@ ThrowCompletionOr to_temporal_month_day(GlobalObject& global_obj MUST(fields->create_data_property_or_throw(vm.names.year, Value(reference_iso_year))); } - // j. Return ? MonthDayFromFields(calendar, fields, options). - return month_day_from_fields(global_object, *calendar, *fields, options); + // j. Return ? CalendarMonthDayFromFields(calendar, fields, options). + return calendar_month_day_from_fields(global_object, *calendar, *fields, options); } // 5. Perform ? ToTemporalOverflow(options). @@ -139,8 +139,8 @@ ThrowCompletionOr to_temporal_month_day(GlobalObject& global_obj auto* plain_month_day = TRY(create_temporal_month_day(global_object, result.month, result.day, *calendar, reference_iso_year)); // 11. NOTE: The following operation is called without options, in order for the calendar to store a canonical value in the [[ISOYear]] internal slot of the result. - // 12. Return ? MonthDayFromFields(calendar, result). - return TRY(month_day_from_fields(global_object, *calendar, *plain_month_day)); + // 12. Return ? CalendarMonthDayFromFields(calendar, result). + return TRY(calendar_month_day_from_fields(global_object, *calendar, *plain_month_day)); } // 10.5.2 CreateTemporalMonthDay ( isoMonth, isoDay, calendar, referenceISOYear [ , newTarget ] ), https://tc39.es/proposal-temporal/#sec-temporal-createtemporalmonthday diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 3d02b7bd95..9bf5c30814 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -121,8 +121,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with) // 11. Set fields to ? PrepareTemporalFields(fields, fieldNames, «»). fields = TRY(prepare_temporal_fields(global_object, *fields, field_names, {})); - // 12. Return ? MonthDayFromFields(calendar, fields, options). - return TRY(month_day_from_fields(global_object, calendar, *fields, options)); + // 12. Return ? CalendarMonthDayFromFields(calendar, fields, options). + return TRY(calendar_month_day_from_fields(global_object, calendar, *fields, options)); } // 10.3.7 Temporal.PlainMonthDay.prototype.equals ( other ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.equals @@ -251,8 +251,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date) // 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject"). MUST(options->create_data_property_or_throw(vm.names.overflow, js_string(vm, vm.names.reject.as_string()))); - // 14. Return ? DateFromFields(calendar, mergedFields, options). - return TRY(date_from_fields(global_object, calendar, *merged_fields, options)); + // 14. Return ? CalendarDateFromFields(calendar, mergedFields, options). + return TRY(calendar_date_from_fields(global_object, calendar, *merged_fields, options)); } // 10.3.13 Temporal.PlainMonthDay.prototype.getISOFields ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.getisofields diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp index 6e9d3124e7..feceefc5c3 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp @@ -57,8 +57,8 @@ ThrowCompletionOr to_temporal_year_month(GlobalObject& global_o // d. Let fields be ? PrepareTemporalFields(item, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, item_object, field_names, {})); - // e. Return ? YearMonthFromFields(calendar, fields, options). - return year_month_from_fields(global_object, *calendar, *fields, options); + // e. Return ? CalendarYearMonthFromFields(calendar, fields, options). + return calendar_year_month_from_fields(global_object, *calendar, *fields, options); } // 4. Perform ? ToTemporalOverflow(options). @@ -77,8 +77,8 @@ ThrowCompletionOr to_temporal_year_month(GlobalObject& global_o auto* creation_result = TRY(create_temporal_year_month(global_object, result.year, result.month, *calendar, result.day)); // 9. NOTE: The following operation is called without options, in order for the calendar to store a canonical value in the [[ISODay]] internal slot of the result. - // 10. Return ? YearMonthFromFields(calendar, result). - return year_month_from_fields(global_object, *calendar, *creation_result); + // 10. Return ? CalendarYearMonthFromFields(calendar, result). + return calendar_year_month_from_fields(global_object, *calendar, *creation_result); } // 9.5.2 RegulateISOYearMonth ( year, month, overflow ), https://tc39.es/proposal-temporal/#sec-temporal-regulateisoyearmonth diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index 6817b93523..8c9b922fda 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -232,8 +232,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with) // 11. Set fields to ? PrepareTemporalFields(fields, fieldNames, «»). fields = TRY(prepare_temporal_fields(global_object, *fields, field_names, {})); - // 12. Return ? YearMonthFromFields(calendar, fields, options). - return TRY(year_month_from_fields(global_object, calendar, *fields, options)); + // 12. Return ? CalendarYearMonthFromFields(calendar, fields, options). + return TRY(calendar_year_month_from_fields(global_object, calendar, *fields, options)); } // 9.3.12 Temporal.PlainYearMonth.prototype.add ( temporalDurationLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.add @@ -283,8 +283,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::add) // 12. Perform ! CreateDataPropertyOrThrow(fields, "day", day). MUST(fields->create_data_property_or_throw(vm.names.day, Value(day))); - // 13. Let date be ? DateFromFields(calendar, fields, undefined). - auto* date = TRY(date_from_fields(global_object, calendar, *fields, nullptr)); + // 13. Let date be ? CalendarDateFromFields(calendar, fields, undefined). + auto* date = TRY(calendar_date_from_fields(global_object, calendar, *fields, nullptr)); // 14. Let durationToAdd be ! CreateTemporalDuration(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], balanceResult.[[Days]], 0, 0, 0, 0, 0, 0). auto* duration_to_add = MUST(create_temporal_duration(global_object, duration.years, duration.months, duration.weeks, balance_result.days, 0, 0, 0, 0, 0, 0)); @@ -310,8 +310,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::add) // 19. Let addedDateFields be ? PrepareTemporalFields(addedDate, fieldNames, «»). auto* added_date_fields = TRY(prepare_temporal_fields(global_object, *added_date, field_names, {})); - // 20. Return ? YearMonthFromFields(calendar, addedDateFields, optionsCopy). - return TRY(year_month_from_fields(global_object, calendar, *added_date_fields, options_copy)); + // 20. Return ? CalendarYearMonthFromFields(calendar, addedDateFields, optionsCopy). + return TRY(calendar_year_month_from_fields(global_object, calendar, *added_date_fields, options_copy)); } // 9.3.13 Temporal.PlainYearMonth.prototype.subtract ( temporalDurationLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.subtract @@ -368,8 +368,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::subtract) // 13. Perform ! CreateDataPropertyOrThrow(fields, "day", day). MUST(fields->create_data_property_or_throw(vm.names.day, Value(day))); - // 14. Let date be ? DateFromFields(calendar, fields, undefined). - auto* date = TRY(date_from_fields(global_object, calendar, *fields, nullptr)); + // 14. Let date be ? CalendarDateFromFields(calendar, fields, undefined). + auto* date = TRY(calendar_date_from_fields(global_object, calendar, *fields, nullptr)); // 15. Let durationToAdd be ! CreateTemporalDuration(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], balanceResult.[[Days]], 0, 0, 0, 0, 0, 0). auto* duration_to_add = MUST(create_temporal_duration(global_object, duration->years(), duration->months(), duration->weeks(), balance_result.days, 0, 0, 0, 0, 0, 0)); @@ -395,8 +395,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::subtract) // 20. Let addedDateFields be ? PrepareTemporalFields(addedDate, fieldNames, «»). auto* added_date_fields = TRY(prepare_temporal_fields(global_object, *added_date, field_names, {})); - // 21. Return ? YearMonthFromFields(calendar, addedDateFields, optionsCopy). - return TRY(year_month_from_fields(global_object, calendar, *added_date_fields, options_copy)); + // 21. Return ? CalendarYearMonthFromFields(calendar, addedDateFields, optionsCopy). + return TRY(calendar_year_month_from_fields(global_object, calendar, *added_date_fields, options_copy)); } // 9.3.14 Temporal.PlainYearMonth.prototype.until ( other [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.until @@ -446,8 +446,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::until) // 15. Perform ! CreateDataPropertyOrThrow(otherFields, "day", 1𝔽). MUST(other_fields->create_data_property_or_throw(vm.names.day, Value(1))); - // 16. Let otherDate be ? DateFromFields(calendar, otherFields). - auto* other_date = TRY(date_from_fields(global_object, calendar, *other_fields)); + // 16. Let otherDate be ? CalendarDateFromFields(calendar, otherFields). + auto* other_date = TRY(calendar_date_from_fields(global_object, calendar, *other_fields)); // 17. Let thisFields be ? PrepareTemporalFields(yearMonth, fieldNames, «»). auto* this_fields = TRY(prepare_temporal_fields(global_object, *year_month, field_names, {})); @@ -455,8 +455,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::until) // 18. Perform ! CreateDataPropertyOrThrow(thisFields, "day", 1𝔽). MUST(this_fields->create_data_property_or_throw(vm.names.day, Value(1))); - // 19. Let thisDate be ? DateFromFields(calendar, thisFields). - auto* this_date = TRY(date_from_fields(global_object, calendar, *this_fields)); + // 19. Let thisDate be ? CalendarDateFromFields(calendar, thisFields). + auto* this_date = TRY(calendar_date_from_fields(global_object, calendar, *this_fields)); // 20. Let untilOptions be ? MergeLargestUnitOption(options, largestUnit). auto* until_options = TRY(merge_largest_unit_option(global_object, options, *largest_unit)); @@ -527,8 +527,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::since) // 16. Perform ! CreateDataPropertyOrThrow(otherFields, "day", 1𝔽). MUST(other_fields->create_data_property_or_throw(vm.names.day, Value(1))); - // 17. Let otherDate be ? DateFromFields(calendar, otherFields). - auto* other_date = TRY(date_from_fields(global_object, calendar, *other_fields)); + // 17. Let otherDate be ? CalendarDateFromFields(calendar, otherFields). + auto* other_date = TRY(calendar_date_from_fields(global_object, calendar, *other_fields)); // 18. Let thisFields be ? PrepareTemporalFields(yearMonth, fieldNames, «»). auto* this_fields = TRY(prepare_temporal_fields(global_object, *year_month, field_names, {})); @@ -536,8 +536,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::since) // 19. Perform ! CreateDataPropertyOrThrow(thisFields, "day", 1𝔽). MUST(this_fields->create_data_property_or_throw(vm.names.day, Value(1))); - // 20. Let thisDate be ? DateFromFields(calendar, thisFields). - auto* this_date = TRY(date_from_fields(global_object, calendar, *this_fields)); + // 20. Let thisDate be ? CalendarDateFromFields(calendar, thisFields). + auto* this_date = TRY(calendar_date_from_fields(global_object, calendar, *this_fields)); // 21. Let untilOptions be ? MergeLargestUnitOption(options, largestUnit). auto* until_options = TRY(merge_largest_unit_option(global_object, options, *largest_unit)); @@ -684,8 +684,8 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date) // 13. Perform ! CreateDataPropertyOrThrow(options, "overflow", "reject"). MUST(options->create_data_property_or_throw(vm.names.overflow, js_string(vm, vm.names.reject.as_string()))); - // 14. Return ? DateFromFields(calendar, mergedFields, options). - return TRY(date_from_fields(global_object, calendar, *merged_fields, options)); + // 14. Return ? CalendarDateFromFields(calendar, mergedFields, options). + return TRY(calendar_date_from_fields(global_object, calendar, *merged_fields, options)); } // 9.3.22 Temporal.PlainYearMonth.prototype.getISOFields ( ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.getisofields diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 3bb05b93ac..6333c3dfd4 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -1401,8 +1401,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_year_month) // 8. Let fields be ? PrepareTemporalFields(temporalDateTime, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *temporal_date_time, field_names, {})); - // 9. Return ? YearMonthFromFields(calendar, fields). - return TRY(year_month_from_fields(global_object, calendar, *fields)); + // 9. Return ? CalendarYearMonthFromFields(calendar, fields). + return TRY(calendar_year_month_from_fields(global_object, calendar, *fields)); } // 6.3.51 Temporal.ZonedDateTime.prototype.toPlainMonthDay ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.toplainmonthday @@ -1430,8 +1430,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_plain_month_day) // 8. Let fields be ? PrepareTemporalFields(temporalDateTime, fieldNames, «»). auto* fields = TRY(prepare_temporal_fields(global_object, *temporal_date_time, field_names, {})); - // 9. Return ? MonthDayFromFields(calendar, fields). - return TRY(month_day_from_fields(global_object, calendar, *fields)); + // 9. Return ? CalendarMonthDayFromFields(calendar, fields). + return TRY(calendar_month_day_from_fields(global_object, calendar, *fields)); } // 6.3.52 Temporal.ZonedDateTime.prototype.getISOFields ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.getisofields