LibJS: Pass calendar strings around as String more regularly

Same as commit f9fa548d43.

These are String from the outset, so this patch is almost entirely just
changing function parameter types. This will allow us to cache calendar
objects in ICU without invoking any extra allocations.
This commit is contained in:
Timothy Flynn
2026-03-06 07:52:58 -05:00
committed by Jelle Raaijmakers
parent 88365031f2
commit 2e74b91ca1
Notes: github-actions[bot] 2026-03-09 10:42:49 +00:00
15 changed files with 103 additions and 98 deletions

View File

@@ -35,16 +35,16 @@ private:
ISODateTime time_value_to_iso_date_time_record(double time_value);
ISODateTime combine_iso_date_and_time_record(ISODate, Time const&);
bool iso_date_time_within_limits(ISODateTime const&);
ThrowCompletionOr<ISODateTime> interpret_temporal_date_time_fields(VM&, StringView calendar, CalendarFields&, Overflow);
ThrowCompletionOr<ISODateTime> interpret_temporal_date_time_fields(VM&, String const& calendar, CalendarFields&, Overflow);
ThrowCompletionOr<GC::Ref<PlainDateTime>> to_temporal_date_time(VM&, Value item, Value options = js_undefined());
ISODateTime balance_iso_date_time(double year, double month, double day, double hour, double minute, double second, double millisecond, double microsecond, double nanosecond);
ThrowCompletionOr<GC::Ref<PlainDateTime>> create_temporal_date_time(VM&, ISODateTime const&, String calendar, GC::Ptr<FunctionObject> new_target = {});
String iso_date_time_to_string(ISODateTime const&, StringView calendar, SecondsStringPrecision::Precision, ShowCalendar);
String iso_date_time_to_string(ISODateTime const&, String const& calendar, SecondsStringPrecision::Precision, ShowCalendar);
i8 compare_iso_date_time(ISODateTime const&, ISODateTime const&);
ISODateTime round_iso_date_time(ISODateTime const&, u64 increment, Unit, RoundingMode);
InternalDuration difference_iso_date_time(VM&, ISODateTime const&, ISODateTime const&, StringView calendar, Unit largest_unit);
ThrowCompletionOr<InternalDuration> difference_plain_date_time_with_rounding(VM&, ISODateTime const&, ISODateTime const&, StringView calendar, Unit largest_unit, u64 rounding_increment, Unit smallest_unit, RoundingMode);
ThrowCompletionOr<Crypto::BigFraction> difference_plain_date_time_with_total(VM&, ISODateTime const&, ISODateTime const&, StringView calendar, Unit);
InternalDuration difference_iso_date_time(VM&, ISODateTime const&, ISODateTime const&, String const& calendar, Unit largest_unit);
ThrowCompletionOr<InternalDuration> difference_plain_date_time_with_rounding(VM&, ISODateTime const&, ISODateTime const&, String const& calendar, Unit largest_unit, u64 rounding_increment, Unit smallest_unit, RoundingMode);
ThrowCompletionOr<Crypto::BigFraction> difference_plain_date_time_with_total(VM&, ISODateTime const&, ISODateTime const&, String const& calendar, Unit);
ThrowCompletionOr<GC::Ref<Duration>> difference_temporal_plain_date_time(VM&, DurationOperation, PlainDateTime const&, Value other, Value options);
ThrowCompletionOr<GC::Ref<PlainDateTime>> add_duration_to_date_time(VM&, ArithmeticOperation, PlainDateTime const&, Value temporal_duration_like, Value options);