diff options
author | Linus Groh <mail@linusgroh.de> | 2022-06-14 22:03:18 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-15 17:49:20 +0100 |
commit | c8d84f33b0f4ec316794fd85e7894acabd1bf9c7 (patch) | |
tree | 7f0608d9c60e0d349f15978080b53efcc6477266 /Userland/Libraries | |
parent | d1b71cba25d99b5ecc01d56a48498004538d9402 (diff) | |
download | serenity-c8d84f33b0f4ec316794fd85e7894acabd1bf9c7.zip |
LibJS: Remove unused GetStringOrNumberOption operation
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/d8b3423
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 106 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h | 6 |
2 files changed, 39 insertions, 73 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index c748bbd527..4a9f3d75a8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -160,39 +160,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o return value; } -// 13.4 GetStringOrNumberOption ( options, property, stringValues, minimum, maximum, fallback ), https://tc39.es/proposal-temporal/#sec-getstringornumberoption -template<typename NumberType> -ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback) -{ - auto& vm = global_object.vm(); - - // 1. Assert: Type(options) is Object. - - // 2. Let value be ? GetOption(options, property, ยซ Number, String ยป, empty, fallback). - auto value = TRY(get_option(global_object, options, property, { OptionType::Number, OptionType::String }, {}, fallback)); - - // 3. If Type(value) is Number, then - if (value.is_number()) { - // a. If value < minimum or value > maximum, throw a RangeError exception. - if (value.as_double() < minimum || value.as_double() > maximum) - return vm.template throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, value.as_double(), property.as_string()); - - // b. Return floor(โ(value)). - return static_cast<NumberType>(floor(value.as_double())); - } - - // 4. Assert: Type(value) is String. - VERIFY(value.is_string()); - - // 5. If stringValues does not contain value, throw a RangeError exception. - if (!string_values.contains_slow(value.as_string().string())) - return vm.template throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, value.as_string().string(), property.as_string()); - - // 6. Return value. - return value.as_string().string(); -} - -// 13.5 ToTemporalOverflow ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaloverflow +// 13.4 ToTemporalOverflow ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaloverflow ThrowCompletionOr<String> to_temporal_overflow(GlobalObject& global_object, Object const* options) { auto& vm = global_object.vm(); @@ -208,7 +176,7 @@ ThrowCompletionOr<String> to_temporal_overflow(GlobalObject& global_object, Obje return option.as_string().string(); } -// 13.6 ToTemporalDisambiguation ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation +// 13.5 ToTemporalDisambiguation ( options ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation ThrowCompletionOr<String> to_temporal_disambiguation(GlobalObject& global_object, Object const* options) { auto& vm = global_object.vm(); @@ -224,7 +192,7 @@ ThrowCompletionOr<String> to_temporal_disambiguation(GlobalObject& global_object return option.as_string().string(); } -// 13.7 ToTemporalRoundingMode ( normalizedOptions, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode +// 13.6 ToTemporalRoundingMode ( normalizedOptions, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode ThrowCompletionOr<String> to_temporal_rounding_mode(GlobalObject& global_object, Object const& normalized_options, String const& fallback) { auto& vm = global_object.vm(); @@ -236,7 +204,7 @@ ThrowCompletionOr<String> to_temporal_rounding_mode(GlobalObject& global_object, return option.as_string().string(); } -// 13.8 NegateTemporalRoundingMode ( roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-negatetemporalroundingmode +// 13.7 NegateTemporalRoundingMode ( roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-negatetemporalroundingmode StringView negate_temporal_rounding_mode(String const& rounding_mode) { // 1. If roundingMode is "ceil", return "floor". @@ -251,7 +219,7 @@ StringView negate_temporal_rounding_mode(String const& rounding_mode) return rounding_mode; } -// 13.9 ToTemporalOffset ( options, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaloffset +// 13.8 ToTemporalOffset ( options, fallback ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaloffset ThrowCompletionOr<String> to_temporal_offset(GlobalObject& global_object, Object const* options, String const& fallback) { auto& vm = global_object.vm(); @@ -267,7 +235,7 @@ ThrowCompletionOr<String> to_temporal_offset(GlobalObject& global_object, Object return option.as_string().string(); } -// 13.10 ToShowCalendarOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowcalendaroption +// 13.9 ToShowCalendarOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowcalendaroption ThrowCompletionOr<String> to_show_calendar_option(GlobalObject& global_object, Object const& normalized_options) { auto& vm = global_object.vm(); @@ -279,7 +247,7 @@ ThrowCompletionOr<String> to_show_calendar_option(GlobalObject& global_object, O return option.as_string().string(); } -// 13.11 ToShowTimeZoneNameOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowtimezonenameoption +// 13.10 ToShowTimeZoneNameOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowtimezonenameoption ThrowCompletionOr<String> to_show_time_zone_name_option(GlobalObject& global_object, Object const& normalized_options) { auto& vm = global_object.vm(); @@ -291,7 +259,7 @@ ThrowCompletionOr<String> to_show_time_zone_name_option(GlobalObject& global_obj return option.as_string().string(); } -// 13.12 ToShowOffsetOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption +// 13.11 ToShowOffsetOption ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption ThrowCompletionOr<String> to_show_offset_option(GlobalObject& global_object, Object const& normalized_options) { auto& vm = global_object.vm(); @@ -303,7 +271,7 @@ ThrowCompletionOr<String> to_show_offset_option(GlobalObject& global_object, Obj return option.as_string().string(); } -// 13.13 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement +// 13.12 ToTemporalRoundingIncrement ( normalizedOptions, dividend, inclusive ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement ThrowCompletionOr<u64> to_temporal_rounding_increment(GlobalObject& global_object, Object const& normalized_options, Optional<double> dividend, bool inclusive) { auto& vm = global_object.vm(); @@ -351,7 +319,7 @@ ThrowCompletionOr<u64> to_temporal_rounding_increment(GlobalObject& global_objec return floored_increment; } -// 13.14 ToTemporalDateTimeRoundingIncrement ( normalizedOptions, smallestUnit ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldatetimeroundingincrement +// 13.13 ToTemporalDateTimeRoundingIncrement ( normalizedOptions, smallestUnit ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldatetimeroundingincrement ThrowCompletionOr<u64> to_temporal_date_time_rounding_increment(GlobalObject& global_object, Object const& normalized_options, StringView smallest_unit) { double maximum; @@ -384,7 +352,7 @@ ThrowCompletionOr<u64> to_temporal_date_time_rounding_increment(GlobalObject& gl return to_temporal_rounding_increment(global_object, normalized_options, maximum, false); } -// 13.15 ToSecondsStringPrecision ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-tosecondsstringprecision +// 13.14 ToSecondsStringPrecision ( normalizedOptions ), https://tc39.es/proposal-temporal/#sec-temporal-tosecondsstringprecision ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(GlobalObject& global_object, Object const& normalized_options) { auto& vm = global_object.vm(); @@ -501,7 +469,7 @@ static Vector<TemporalUnit> temporal_units = { { "nanosecond"sv, "nanoseconds"sv, UnitGroup::Time } }; -// 13.16 GetTemporalUnit ( normalizedOptions, key, unitGroup, default [ , extraValues ] ), https://tc39.es/proposal-temporal/#sec-temporal-gettemporalunit +// 13.15 GetTemporalUnit ( normalizedOptions, key, unitGroup, default [ , extraValues ] ), https://tc39.es/proposal-temporal/#sec-temporal-gettemporalunit ThrowCompletionOr<Optional<String>> get_temporal_unit(GlobalObject& global_object, Object const& normalized_options, PropertyKey const& key, UnitGroup unit_group, Variant<TemporalUnitRequired, Optional<StringView>> const& default_, Vector<StringView> const& extra_values) { auto& vm = global_object.vm(); @@ -591,7 +559,7 @@ ThrowCompletionOr<Optional<String>> get_temporal_unit(GlobalObject& global_objec return value; } -// 13.17 ToRelativeTemporalObject ( options ), https://tc39.es/proposal-temporal/#sec-temporal-torelativetemporalobject +// 13.16 ToRelativeTemporalObject ( options ), https://tc39.es/proposal-temporal/#sec-temporal-torelativetemporalobject ThrowCompletionOr<Value> to_relative_temporal_object(GlobalObject& global_object, Object const& options) { auto& vm = global_object.vm(); @@ -761,7 +729,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(GlobalObject& global_object return TRY(create_temporal_date(global_object, result.year, result.month, result.day, *calendar)); } -// 13.18 LargerOfTwoTemporalUnits ( u1, u2 ), https://tc39.es/proposal-temporal/#sec-temporal-largeroftwotemporalunits +// 13.17 LargerOfTwoTemporalUnits ( u1, u2 ), https://tc39.es/proposal-temporal/#sec-temporal-largeroftwotemporalunits StringView larger_of_two_temporal_units(StringView unit1, StringView unit2) { // 1. Assert: Both u1 and u2 are listed in the Singular column of Table 13. @@ -782,7 +750,7 @@ StringView larger_of_two_temporal_units(StringView unit1, StringView unit2) VERIFY_NOT_REACHED(); } -// 13.19 MergeLargestUnitOption ( options, largestUnit ), https://tc39.es/proposal-temporal/#sec-temporal-mergelargestunitoption +// 13.18 MergeLargestUnitOption ( options, largestUnit ), https://tc39.es/proposal-temporal/#sec-temporal-mergelargestunitoption ThrowCompletionOr<Object*> merge_largest_unit_option(GlobalObject& global_object, Object const* options, String largest_unit) { auto& vm = global_object.vm(); @@ -815,7 +783,7 @@ ThrowCompletionOr<Object*> merge_largest_unit_option(GlobalObject& global_object return merged; } -// 13.20 MaximumTemporalDurationRoundingIncrement ( unit ), https://tc39.es/proposal-temporal/#sec-temporal-maximumtemporaldurationroundingincrement +// 13.19 MaximumTemporalDurationRoundingIncrement ( unit ), https://tc39.es/proposal-temporal/#sec-temporal-maximumtemporaldurationroundingincrement Optional<u16> maximum_temporal_duration_rounding_increment(StringView unit) { // 1. If unit is "year", "month", "week", or "day", then @@ -843,7 +811,7 @@ Optional<u16> maximum_temporal_duration_rounding_increment(StringView unit) return 1000; } -// 13.21 RejectObjectWithCalendarOrTimeZone ( object ), https://tc39.es/proposal-temporal/#sec-temporal-rejectobjectwithcalendarortimezone +// 13.20 RejectObjectWithCalendarOrTimeZone ( object ), https://tc39.es/proposal-temporal/#sec-temporal-rejectobjectwithcalendarortimezone ThrowCompletionOr<void> reject_object_with_calendar_or_time_zone(GlobalObject& global_object, Object& object) { auto& vm = global_object.vm(); @@ -877,7 +845,7 @@ ThrowCompletionOr<void> reject_object_with_calendar_or_time_zone(GlobalObject& g return {}; } -// 13.22 FormatSecondsStringPart ( second, millisecond, microsecond, nanosecond, precision ), https://tc39.es/proposal-temporal/#sec-temporal-formatsecondsstringpart +// 13.21 FormatSecondsStringPart ( second, millisecond, microsecond, nanosecond, precision ), https://tc39.es/proposal-temporal/#sec-temporal-formatsecondsstringpart String format_seconds_string_part(u8 second, u16 millisecond, u16 microsecond, u16 nanosecond, Variant<StringView, u8> const& precision) { // 1. Assert: second, millisecond, microsecond and nanosecond are integers. @@ -927,7 +895,7 @@ String format_seconds_string_part(u8 second, u16 millisecond, u16 microsecond, u return String::formatted("{}.{}", seconds_string, fraction_string); } -// 13.24 GetUnsignedRoundingMode ( roundingMode, isNegative ), https://tc39.es/proposal-temporal/#sec-temporal-getunsignedroundingmode +// 13.23 GetUnsignedRoundingMode ( roundingMode, isNegative ), https://tc39.es/proposal-temporal/#sec-temporal-getunsignedroundingmode UnsignedRoundingMode get_unsigned_rounding_mode(StringView rounding_mode, bool is_negative) { // 1. If isNegative is true, return the specification type in the third column of Table 14 where the first column is roundingMode and the second column is "negative". @@ -981,7 +949,7 @@ UnsignedRoundingMode get_unsigned_rounding_mode(StringView rounding_mode, bool i // it uses mathematical values which can be arbitrarily (but not infinitely) large. // Incidentally V8's Temporal implementation does the same :^) -// 13.25 ApplyUnsignedRoundingMode ( x, r1, r2, unsignedRoundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-applyunsignedroundingmode +// 13.24 ApplyUnsignedRoundingMode ( x, r1, r2, unsignedRoundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-applyunsignedroundingmode double apply_unsigned_rounding_mode(double x, double r1, double r2, Optional<UnsignedRoundingMode> const& unsigned_rounding_mode) { // 1. If x is equal to r1, return r1. @@ -1041,7 +1009,7 @@ double apply_unsigned_rounding_mode(double x, double r1, double r2, Optional<Uns return r2; } -// 13.25 ApplyUnsignedRoundingMode ( x, r1, r2, unsignedRoundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-applyunsignedroundingmode +// 13.24 ApplyUnsignedRoundingMode ( x, r1, r2, unsignedRoundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-applyunsignedroundingmode Crypto::SignedBigInteger apply_unsigned_rounding_mode(Crypto::SignedDivisionResult const& x, Crypto::SignedBigInteger const& r1, Crypto::SignedBigInteger const& r2, Optional<UnsignedRoundingMode> const& unsigned_rounding_mode, Crypto::UnsignedBigInteger const& increment) { // 1. If x is equal to r1, return r1. @@ -1101,7 +1069,7 @@ Crypto::SignedBigInteger apply_unsigned_rounding_mode(Crypto::SignedDivisionResu return r2; } -// 13.26 RoundNumberToIncrement ( x, increment, roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement +// 13.25 RoundNumberToIncrement ( x, increment, roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement double round_number_to_increment(double x, u64 increment, StringView rounding_mode) { VERIFY(rounding_mode == "ceil"sv || rounding_mode == "floor"sv || rounding_mode == "trunc"sv || rounding_mode == "halfExpand"sv); @@ -1147,7 +1115,7 @@ double round_number_to_increment(double x, u64 increment, StringView rounding_mo return rounded * static_cast<double>(increment); } -// 13.26 RoundNumberToIncrement ( x, increment, roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement +// 13.25 RoundNumberToIncrement ( x, increment, roundingMode ), https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement Crypto::SignedBigInteger round_number_to_increment(Crypto::SignedBigInteger const& x, u64 increment, StringView rounding_mode) { VERIFY(rounding_mode == "ceil"sv || rounding_mode == "floor"sv || rounding_mode == "trunc"sv || rounding_mode == "halfExpand"sv); @@ -1202,7 +1170,7 @@ Crypto::SignedBigInteger round_number_to_increment(Crypto::SignedBigInteger cons return rounded.multiplied_by(increment_big_int); } -// 13.28 ParseISODateTime ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parseisodatetime +// 13.26 ParseISODateTime ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parseisodatetime ThrowCompletionOr<ISODateTime> parse_iso_date_time(GlobalObject& global_object, ParseResult const& parse_result) { auto& vm = global_object.vm(); @@ -1349,7 +1317,7 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(GlobalObject& global_object, return ISODateTime { .year = year_mv, .month = month_mv, .day = day_mv, .hour = hour_mv, .minute = minute_mv, .second = second_mv, .millisecond = millisecond_mv, .microsecond = microsecond_mv, .nanosecond = nanosecond_mv, .calendar = move(calendar_val) }; } -// 13.29 ParseTemporalInstantString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalinstantstring +// 13.28 ParseTemporalInstantString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalinstantstring ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1381,7 +1349,7 @@ ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(GlobalObject& g return TemporalInstant { .year = result.year, .month = result.month, .day = result.day, .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .time_zone_offset = move(offset_string) }; } -// 13.30 ParseTemporalZonedDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalzoneddatetimestring +// 13.29 ParseTemporalZonedDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalzoneddatetimestring ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_zoned_date_time_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1403,7 +1371,7 @@ ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_zoned_date_time_string(G return TemporalZonedDateTime { .date_time = move(result), .time_zone = move(time_zone_result) }; } -// 13.31 ParseTemporalCalendarString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring +// 13.30 ParseTemporalCalendarString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring ThrowCompletionOr<String> parse_temporal_calendar_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1428,7 +1396,7 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(GlobalObject& global_ob return id.value(); } -// 13.32 ParseTemporalDateString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatestring +// 13.31 ParseTemporalDateString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatestring ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject& global_object, String const& iso_string) { // 1. Let parts be ? ParseTemporalDateTimeString(isoString). @@ -1438,7 +1406,7 @@ ThrowCompletionOr<TemporalDate> parse_temporal_date_string(GlobalObject& global_ return TemporalDate { .year = parts.year, .month = parts.month, .day = parts.day, .calendar = move(parts.calendar) }; } -// 13.33 ParseTemporalDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatetimestring +// 13.32 ParseTemporalDateTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatetimestring ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1458,7 +1426,7 @@ ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(GlobalObject& glo return parse_iso_date_time(global_object, *parse_result); } -// 13.34 ParseTemporalDurationString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring +// 13.33 ParseTemporalDurationString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1598,7 +1566,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g return create_duration_record(global_object, years * factor, months * factor, weeks * factor, days * factor, hours * factor, floor(minutes) * factor, floor(seconds) * factor, floor(milliseconds) * factor, floor(microseconds) * factor, floor(nanoseconds) * factor); } -// 13.35 ParseTemporalMonthDayString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalmonthdaystring +// 13.34 ParseTemporalMonthDayString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalmonthdaystring ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1630,7 +1598,7 @@ ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(GlobalObject return TemporalMonthDay { .year = year, .month = result.month, .day = result.day, .calendar = move(result.calendar) }; } -// 13.36 ParseTemporalRelativeToString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring +// 13.35 ParseTemporalRelativeToString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_relative_to_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1675,7 +1643,7 @@ ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_relative_to_string(Globa return TemporalZonedDateTime { .date_time = move(result), .time_zone = { .z = z, .offset_string = move(offset_string), .name = move(time_zone) } }; } -// 13.37 ParseTemporalTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring +// 13.36 ParseTemporalTimeString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimestring ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1698,7 +1666,7 @@ ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_ return TemporalTime { .hour = result.hour, .minute = result.minute, .second = result.second, .millisecond = result.millisecond, .microsecond = result.microsecond, .nanosecond = result.nanosecond, .calendar = move(result.calendar) }; } -// 13.38 ParseTemporalTimeZoneString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimezonestring +// 13.37 ParseTemporalTimeZoneString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimezonestring ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1737,7 +1705,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject return TemporalTimeZone { .z = false, .offset_string = Optional<String>(move(offset_string)), .name = Optional<String>(move(name)) }; } -// 13.39 ParseTemporalYearMonthString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalyearmonthstring +// 13.38 ParseTemporalYearMonthString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalyearmonthstring ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(GlobalObject& global_object, String const& iso_string) { auto& vm = global_object.vm(); @@ -1760,7 +1728,7 @@ ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(GlobalObje return TemporalYearMonth { .year = result.year, .month = result.month, .day = result.day, .calendar = move(result.calendar) }; } -// 13.40 ToPositiveInteger ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-topositiveinteger +// 13.39 ToPositiveInteger ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-topositiveinteger ThrowCompletionOr<double> to_positive_integer(GlobalObject& global_object, Value argument) { auto& vm = global_object.vm(); @@ -1778,7 +1746,7 @@ ThrowCompletionOr<double> to_positive_integer(GlobalObject& global_object, Value return integer; } -// 13.43 PrepareTemporalFields ( fields, fieldNames, requiredFields ), https://tc39.es/proposal-temporal/#sec-temporal-preparetemporalfields +// 13.42 PrepareTemporalFields ( fields, fieldNames, requiredFields ), https://tc39.es/proposal-temporal/#sec-temporal-preparetemporalfields ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, Object const& fields, Vector<String> const& field_names, Variant<PrepareTemporalFieldsPartial, Vector<StringView>> const& required_fields) { auto& vm = global_object.vm(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index c85ea7e1dd..f1d981c0b5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -127,8 +127,6 @@ struct PrepareTemporalFieldsPartial { }; ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types); ThrowCompletionOr<Object*> get_options_object(GlobalObject&, Value options); ThrowCompletionOr<Value> get_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback); -template<typename NumberType> -ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback); ThrowCompletionOr<String> to_temporal_overflow(GlobalObject&, Object const* options); ThrowCompletionOr<String> to_temporal_disambiguation(GlobalObject&, Object const* options); ThrowCompletionOr<String> to_temporal_rounding_mode(GlobalObject&, Object const& normalized_options, String const& fallback); @@ -169,7 +167,7 @@ ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(GlobalObje ThrowCompletionOr<double> to_positive_integer(GlobalObject&, Value argument); ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject&, Object const& fields, Vector<String> const& field_names, Variant<PrepareTemporalFieldsPartial, Vector<StringView>> const& required_fields); -// 13.41 ToIntegerThrowOnInfinity ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-tointegerthrowoninfinity +// 13.40 ToIntegerThrowOnInfinity ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-tointegerthrowoninfinity template<typename... Args> ThrowCompletionOr<double> to_integer_throw_on_infinity(GlobalObject& global_object, Value argument, ErrorType error_type, Args... args) { @@ -188,7 +186,7 @@ ThrowCompletionOr<double> to_integer_throw_on_infinity(GlobalObject& global_obje return integer; } -// 13.42 ToIntegerWithoutRounding ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-tointegerwithoutrounding +// 13.41 ToIntegerWithoutRounding ( argument ), https://tc39.es/proposal-temporal/#sec-temporal-tointegerwithoutrounding template<typename... Args> ThrowCompletionOr<double> to_integer_without_rounding(GlobalObject& global_object, Value argument, ErrorType error_type, Args... args) { |