diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal')
32 files changed, 184 insertions, 184 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index f5adef89f0..d579d96b5e 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -65,7 +65,7 @@ ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject& gl // ii. If Type(nextValue) is not an element of elementTypes, then if (auto type = to_option_type(next_value); !type.has_value() || !element_types.contains_slow(*type)) { // 1. Let completion be ThrowCompletion(a newly created TypeError object). - auto completion = vm.throw_completion<TypeError>(global_object, ErrorType::IterableToListOfTypeInvalidValue, next_value.to_string_without_side_effects()); + auto completion = vm.throw_completion<TypeError>(ErrorType::IterableToListOfTypeInvalidValue, next_value.to_string_without_side_effects()); // 2. Return ? IteratorClose(iteratorRecord, completion). return iterator_close(global_object, iterator_record, move(completion)); } @@ -97,7 +97,7 @@ ThrowCompletionOr<Object*> get_options_object(GlobalObject& global_object, Value } // 3. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, "Options"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, "Options"); } // 13.3 GetOption ( options, property, type, values, fallback ), https://tc39.es/proposal-temporal/#sec-getoption @@ -114,7 +114,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o if (value.is_undefined()) { // a. If default is required, throw a RangeError exception. if (default_.has<GetOptionRequired>()) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, "undefined"sv, property.as_string()); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, "undefined"sv, property.as_string()); // b. Return default. return default_.visit( @@ -137,7 +137,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o // b. If value is NaN, throw a RangeError exception. if (value.is_nan()) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, vm.names.NaN.as_string(), property.as_string()); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, vm.names.NaN.as_string(), property.as_string()); } // 7. Else, else { @@ -153,7 +153,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o // NOTE: Every location in the spec that invokes GetOption with type=boolean also has values=undefined. VERIFY(value.is_string()); if (!values.contains_slow(value.as_string().string())) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, value.as_string().string(), property.as_string()); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, value.as_string().string(), property.as_string()); } // 9. Return value. @@ -305,7 +305,7 @@ ThrowCompletionOr<u64> to_temporal_rounding_increment(GlobalObject& global_objec // 6. If increment < 1๐ฝ or increment > maximum, throw a RangeError exception. if (increment < 1 || increment > maximum) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, increment, "roundingIncrement"); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, increment, "roundingIncrement"); // 7. Set increment to floor(โ(increment)). auto floored_increment = static_cast<u64>(increment); @@ -313,7 +313,7 @@ ThrowCompletionOr<u64> to_temporal_rounding_increment(GlobalObject& global_objec // 8. If dividend is not undefined and dividend modulo increment is not zero, then if (dividend.has_value() && static_cast<u64>(*dividend) % floored_increment != 0) // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, increment, "roundingIncrement"); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, increment, "roundingIncrement"); // 9. Return increment. return floored_increment; @@ -350,7 +350,7 @@ ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(GlobalObje // 2. If smallestUnit is "hour", throw a RangeError exception. if (smallest_unit == "hour"sv) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, *smallest_unit, "smallestUnit"sv); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, *smallest_unit, "smallestUnit"sv); // 3. If smallestUnit is "minute", then if (smallest_unit == "minute"sv) { @@ -394,7 +394,7 @@ ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(GlobalObje if (!fractional_digits_value.is_undefined()) { // i. If ? ToString(fractionalDigitsVal) is not "auto", throw a RangeError exception. if (TRY(fractional_digits_value.to_string(global_object)) != "auto"sv) - return vm.template throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); + return vm.template throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); } // b. Return the Record { [[Precision]]: "auto", [[Unit]]: "nanosecond", [[Increment]]: 1 }. @@ -403,14 +403,14 @@ ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(GlobalObje // 11. If fractionalDigitsVal is NaN, +โ๐ฝ, or -โ๐ฝ, throw a RangeError exception. if (fractional_digits_value.is_nan() || fractional_digits_value.is_infinity()) - return vm.template throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); + return vm.template throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); // 12. Let fractionalDigitCount be RoundTowardsZero(โ(fractionalDigitsVal)). auto fractional_digit_count_unchecked = trunc(fractional_digits_value.as_double()); // 13. If fractionalDigitCount < 0 or fractionalDigitCount > 9, throw a RangeError exception. if (fractional_digit_count_unchecked < 0 || fractional_digit_count_unchecked > 9) - return vm.template throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); + return vm.template throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv); auto fractional_digit_count = static_cast<u8>(fractional_digit_count_unchecked); @@ -531,7 +531,7 @@ ThrowCompletionOr<Optional<String>> get_temporal_unit(GlobalObject& global_objec // 10. If value is undefined and default is required, throw a RangeError exception. if (option_value.is_undefined() && default_.has<TemporalUnitRequired>()) - return vm.throw_completion<RangeError>(global_object, ErrorType::IsUndefined, String::formatted("{} option value", key.as_string())); + return vm.throw_completion<RangeError>(ErrorType::IsUndefined, String::formatted("{} option value", key.as_string())); Optional<String> value = option_value.is_undefined() ? Optional<String> {} @@ -657,7 +657,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(GlobalObject& global_object if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) { // 1. If IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception. if (!is_valid_time_zone_name(*time_zone_name)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); // 2. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName). time_zone_name = canonicalize_time_zone_name(*time_zone_name); @@ -809,7 +809,7 @@ ThrowCompletionOr<void> reject_object_with_calendar_or_time_zone(GlobalObject& g // 2. If object has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalTime]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then if (is<PlainDate>(object) || is<PlainDateTime>(object) || is<PlainMonthDay>(object) || is<PlainTime>(object) || is<PlainYearMonth>(object) || is<ZonedDateTime>(object)) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustNotHave, "calendar or timeZone"); + return vm.throw_completion<TypeError>(ErrorType::TemporalObjectMustNotHave, "calendar or timeZone"); } // 3. Let calendarProperty be ? Get(object, "calendar"). @@ -818,7 +818,7 @@ ThrowCompletionOr<void> reject_object_with_calendar_or_time_zone(GlobalObject& g // 4. If calendarProperty is not undefined, then if (!calendar_property.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustNotHave, "calendar"); + return vm.throw_completion<TypeError>(ErrorType::TemporalObjectMustNotHave, "calendar"); } // 5. Let timeZoneProperty be ? Get(object, "timeZone"). @@ -827,7 +827,7 @@ ThrowCompletionOr<void> reject_object_with_calendar_or_time_zone(GlobalObject& g // 6. If timeZoneProperty is not undefined, then if (!time_zone_property.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustNotHave, "timeZone"); + return vm.throw_completion<TypeError>(ErrorType::TemporalObjectMustNotHave, "timeZone"); } return {}; @@ -1315,11 +1315,11 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(GlobalObject& global_object, // 20. If IsValidISODate(yearMV, monthMV, dayMV) is false, throw a RangeError exception. if (!is_valid_iso_date(year_mv, month_mv, day_mv)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidISODate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidISODate); // 21. If IsValidTime(hourMV, minuteMV, secondMV, millisecondMV, microsecondMV, nanosecondMV) is false, throw a RangeError exception. if (!is_valid_time(hour_mv, minute_mv, second_mv, millisecond_mv, microsecond_mv, nanosecond_mv)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTime); Optional<String> calendar_val; @@ -1347,7 +1347,7 @@ ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(GlobalObject& g // 1. If ParseText(StringToCodePoints(isoString), TemporalInstantString) is a List of errors, throw a RangeError exception. auto parse_result = parse_iso8601(Production::TemporalInstantString, iso_string); if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidInstantString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidInstantString, iso_string); // 2. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1379,7 +1379,7 @@ ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_zoned_date_time_string(G // 1. If ParseText(StringToCodePoints(isoString), TemporalZonedDateTimeString) is a List of errors, throw a RangeError exception. auto parse_result = parse_iso8601(Production::TemporalZonedDateTimeString, iso_string); if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidZonedDateTimeString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidZonedDateTimeString, iso_string); // 2. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1403,7 +1403,7 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(GlobalObject& global_ob // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarString, iso_string); // 3. Let id be the source text matched by the CalendarName Parse Node contained within parseResult, or an empty sequence of code points if not present. auto id = parse_result->calendar_name; @@ -1438,11 +1438,11 @@ ThrowCompletionOr<ISODateTime> parse_temporal_date_time_string(GlobalObject& glo // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDateTimeString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDateTimeString, iso_string); // 3. If parseResult contains a UTCDesignator Parse Node, throw a RangeError exception. if (parse_result->utc_designator.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDateTimeStringUTCDesignator, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDateTimeStringUTCDesignator, iso_string); // 4. Return ? ParseISODateTime(isoString). return parse_iso_date_time(global_object, *parse_result); @@ -1458,7 +1458,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g // 2. If duration is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationString, iso_string); // 3. Let each of sign, years, months, weeks, days, hours, fHours, minutes, fMinutes, seconds, and fSeconds be the source text matched by the respective Sign, DurationYears, DurationMonths, DurationWeeks, DurationDays, DurationWholeHours, DurationHoursFraction, DurationWholeMinutes, DurationMinutesFraction, DurationWholeSeconds, and DurationSecondsFraction Parse Node contained within duration, or an empty sequence of code points if not present. auto sign_part = parse_result->sign; @@ -1496,7 +1496,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g if (f_hours_part.has_value()) { // a. If any of minutes, fMinutes, seconds, fSeconds is not empty, throw a RangeError exception. if (minutes_part.has_value() || f_minutes_part.has_value() || seconds_part.has_value() || f_seconds_part.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "hours"sv, "minutes or seconds"sv); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "hours"sv, "minutes or seconds"sv); // b. Let fHoursDigits be the substring of CodePointsToString(fHours) from 1. auto f_hours_digits = f_hours_part->substring_view(1); @@ -1519,7 +1519,7 @@ ThrowCompletionOr<DurationRecord> parse_temporal_duration_string(GlobalObject& g if (f_minutes_part.has_value()) { // a. If any of seconds, fSeconds is not empty, throw a RangeError exception. if (seconds_part.has_value() || f_seconds_part.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "minutes"sv, "seconds"sv); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationStringFractionNotLast, iso_string, "minutes"sv, "seconds"sv); // b. Let fMinutesDigits be the substring of CodePointsToString(fMinutes) from 1. auto f_minutes_digits = f_minutes_part->substring_view(1); @@ -1598,11 +1598,11 @@ ThrowCompletionOr<TemporalMonthDay> parse_temporal_month_day_string(GlobalObject // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthDayString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthDayString, iso_string); // 3. If parseResult contains a UTCDesignator Parse Node, throw a RangeError exception. if (parse_result->utc_designator.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthDayStringUTCDesignator, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthDayStringUTCDesignator, iso_string); // 4. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1628,7 +1628,7 @@ ThrowCompletionOr<TemporalZonedDateTime> parse_temporal_relative_to_string(Globa // 1. If ParseText(StringToCodePoints(isoString), TemporalDateTimeString) is a List of errors, throw a RangeError exception. auto parse_result = parse_iso8601(Production::TemporalDateTimeString, iso_string); if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDateTimeString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDateTimeString, iso_string); // 2. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1675,11 +1675,11 @@ ThrowCompletionOr<TemporalTime> parse_temporal_time_string(GlobalObject& global_ // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeString, iso_string); // 3. If parseResult contains a UTCDesignator Parse Node, throw a RangeError exception. if (parse_result->utc_designator.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeStringUTCDesignator, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeStringUTCDesignator, iso_string); // 4. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1698,7 +1698,7 @@ ThrowCompletionOr<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneString, iso_string); // 3. Let each of z, offsetString, and name be the source text matched by the respective UTCDesignator, TimeZoneNumericUTCOffset, and TimeZoneIdentifier Parse Nodes contained within parseResult, or an empty sequence of code points if not present. auto z = parse_result->utc_designator; @@ -1737,11 +1737,11 @@ ThrowCompletionOr<TemporalYearMonth> parse_temporal_year_month_string(GlobalObje // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidYearMonthString, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidYearMonthString, iso_string); // 3. If parseResult contains a UTCDesignator Parse Node, throw a RangeError exception. if (parse_result->utc_designator.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidYearMonthStringUTCDesignator, iso_string); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidYearMonthStringUTCDesignator, iso_string); // 4. Let result be ? ParseISODateTime(isoString). auto result = TRY(parse_iso_date_time(global_object, *parse_result)); @@ -1761,7 +1761,7 @@ ThrowCompletionOr<double> to_positive_integer(GlobalObject& global_object, Value // 2. If integer โค 0, then if (integer <= 0) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalPropertyMustBePositiveInteger); + return vm.throw_completion<RangeError>(ErrorType::TemporalPropertyMustBePositiveInteger); } // 3. Return integer. @@ -1820,7 +1820,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, // i. If requiredFields contains property, then if (required_fields.get<Vector<StringView>>().contains_slow(property)) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, property); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, property); } // ii. If property is in the Property column of Table 13, then // NOTE: The other properties in the table are automatically handled as their default value is undefined @@ -1837,7 +1837,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object, // 4. If requiredFields is partial and any is false, then if (required_fields.has<PrepareTemporalFieldsPartial>() && !any) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustHaveOneOf, String::join(", "sv, field_names)); + return vm.throw_completion<TypeError>(ErrorType::TemporalObjectMustHaveOneOf, String::join(", "sv, field_names)); } // 5. Return result. @@ -1857,7 +1857,7 @@ ThrowCompletionOr<DifferenceSettings> get_difference_settings(GlobalObject& glob // 3. If disallowedUnits contains smallestUnit, throw a RangeError exception. if (disallowed_units.contains_slow(*smallest_unit)) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, *smallest_unit, "smallestUnit"sv); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, *smallest_unit, "smallestUnit"sv); // 4. Let defaultLargestUnit be ! LargerOfTwoTemporalUnits(smallestLargestDefaultUnit, smallestUnit). auto default_largest_unit = larger_of_two_temporal_units(smallest_largest_default_unit, *smallest_unit); @@ -1867,7 +1867,7 @@ ThrowCompletionOr<DifferenceSettings> get_difference_settings(GlobalObject& glob // 6. If disallowedUnits contains largestUnit, throw a RangeError exception. if (disallowed_units.contains_slow(*largest_unit)) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, *largest_unit, "largestUnit"sv); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, *largest_unit, "largestUnit"sv); // 7. If largestUnit is "auto", set largestUnit to defaultLargestUnit. if (largest_unit == "auto"sv) @@ -1875,7 +1875,7 @@ ThrowCompletionOr<DifferenceSettings> get_difference_settings(GlobalObject& glob // 8. If LargerOfTwoTemporalUnits(largestUnit, smallestUnit) is not largestUnit, throw a RangeError exception. if (larger_of_two_temporal_units(*largest_unit, *smallest_unit) != largest_unit) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidUnitRange, *smallest_unit, *largest_unit); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidUnitRange, *smallest_unit, *largest_unit); // 9. Let roundingMode be ? ToTemporalRoundingMode(options, "trunc"). auto rounding_mode = TRY(to_temporal_rounding_mode(global_object, *options, "trunc"sv)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h index 4f91cc0a39..4dd247ba54 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.h @@ -199,7 +199,7 @@ ThrowCompletionOr<double> to_integer_throw_on_infinity(GlobalObject& global_obje // 2. If integer is -โ or +โ , then if (Value(integer).is_infinity()) { // a. Throw a RangeError exception. - return vm.template throw_completion<RangeError>(global_object, error_type, args...); + return vm.template throw_completion<RangeError>(error_type, args...); } // 3. Return integer. @@ -221,7 +221,7 @@ ThrowCompletionOr<double> to_integer_without_rounding(GlobalObject& global_objec // 3. If IsIntegralNumber(number) is false, throw a RangeError exception. if (!number.is_integral_number()) - return vm.template throw_completion<RangeError>(global_object, error_type, args...); + return vm.template throw_completion<RangeError>(error_type, args...); // 4. Return โ(number). return number.as_double(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index aaa227ac49..e1fc4731c1 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -85,7 +85,7 @@ ThrowCompletionOr<Calendar*> get_builtin_calendar(GlobalObject& global_object, S // 1. If IsBuiltinCalendar(id) is false, throw a RangeError exception. if (!is_builtin_calendar(identifier)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarIdentifier, identifier); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, identifier); // 2. Return ! CreateTemporalCalendar(id). return MUST(create_temporal_calendar(global_object, identifier)); @@ -147,7 +147,7 @@ ThrowCompletionOr<Object*> calendar_merge_fields(GlobalObject& global_object, Ob // 4. If Type(result) is not Object, throw a TypeError exception. if (!result.is_object()) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, result.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, result.to_string_without_side_effects()); // 5. Return result. return &result.as_object(); @@ -173,7 +173,7 @@ ThrowCompletionOr<PlainDate*> calendar_date_add(GlobalObject& global_object, Obj // 6. Perform ? RequireInternalSlot(addedDate, [[InitializedTemporalDate]]). auto* added_date_object = TRY(added_date.to_object(global_object)); if (!is<PlainDate>(added_date_object)) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); // 7. Return addedDate. return static_cast<PlainDate*>(added_date_object); @@ -196,7 +196,7 @@ ThrowCompletionOr<Duration*> calendar_date_until(GlobalObject& global_object, Ob // 4. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]). auto* duration_object = TRY(duration.to_object(global_object)); if (!is<Duration>(duration_object)) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Duration"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.Duration"); // 5. Return duration. return static_cast<Duration*>(duration_object); @@ -213,7 +213,7 @@ ThrowCompletionOr<double> calendar_year(GlobalObject& global_object, Object& cal // 3. If result is undefined, throw a RangeError exception. if (result.is_undefined()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.undefined.as_string()); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.undefined.as_string()); // 4. Return ? ToIntegerThrowOnInfinity(result). return TRY(to_integer_throw_on_infinity(global_object, result, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.year.as_string(), vm.names.Infinity.as_string())); @@ -230,7 +230,7 @@ ThrowCompletionOr<double> calendar_month(GlobalObject& global_object, Object& ca // NOTE: Explicitly handled for a better error message similar to the other calendar property AOs if (result.is_undefined()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.month.as_string(), vm.names.undefined.as_string()); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.month.as_string(), vm.names.undefined.as_string()); // 3. Return ? ToPositiveInteger(result). return TRY(to_positive_integer(global_object, result)); @@ -247,7 +247,7 @@ ThrowCompletionOr<String> calendar_month_code(GlobalObject& global_object, Objec // 3. If result is undefined, throw a RangeError exception. if (result.is_undefined()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.monthCode.as_string(), vm.names.undefined.as_string()); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.monthCode.as_string(), vm.names.undefined.as_string()); // 4. Return ? ToString(result). return result.to_string(global_object); @@ -264,7 +264,7 @@ ThrowCompletionOr<double> calendar_day(GlobalObject& global_object, Object& cale // NOTE: Explicitly handled for a better error message similar to the other calendar property AOs if (result.is_undefined()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.day.as_string(), vm.names.undefined.as_string()); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.day.as_string(), vm.names.undefined.as_string()); // 3. Return ? ToPositiveInteger(result). return TRY(to_positive_integer(global_object, result)); @@ -431,7 +431,7 @@ ThrowCompletionOr<Object*> to_temporal_calendar(GlobalObject& global_object, Val // b. If IsBuiltinCalendar(identifier) is false, throw a RangeError exception. if (!is_builtin_calendar(identifier)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarIdentifier, identifier); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, identifier); } // 4. Return ! CreateTemporalCalendar(identifier). @@ -490,7 +490,7 @@ ThrowCompletionOr<PlainDate*> calendar_date_from_fields(GlobalObject& global_obj // 3. Perform ? RequireInternalSlot(date, [[InitializedTemporalDate]]). auto* date_object = TRY(date.to_object(global_object)); if (!is<PlainDate>(date_object)) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.PlainDate"); // 4. Return date. return static_cast<PlainDate*>(date_object); @@ -509,7 +509,7 @@ ThrowCompletionOr<PlainYearMonth*> calendar_year_month_from_fields(GlobalObject& // 3. Perform ? RequireInternalSlot(yearMonth, [[InitializedTemporalYearMonth]]). auto* year_month_object = TRY(year_month.to_object(global_object)); if (!is<PlainYearMonth>(year_month_object)) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.PlainYearMonth"); // 4. Return yearMonth. return static_cast<PlainYearMonth*>(year_month_object); @@ -528,7 +528,7 @@ ThrowCompletionOr<PlainMonthDay*> calendar_month_day_from_fields(GlobalObject& g // 3. Perform ? RequireInternalSlot(monthDay, [[InitializedTemporalMonthDay]]). auto* month_day_object = TRY(month_day.to_object(global_object)); if (!is<PlainMonthDay>(month_day_object)) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay"); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.PlainMonthDay"); // 4. Return monthDay. return static_cast<PlainMonthDay*>(month_day_object); @@ -600,7 +600,7 @@ ThrowCompletionOr<Object*> consolidate_calendars(GlobalObject& global_object, Ob return &one; // 7. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendar); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendar); } // 12.2.29 ISODaysInMonth ( year, month ), https://tc39.es/proposal-temporal/#sec-temporal-isodaysinmonth @@ -683,7 +683,7 @@ ThrowCompletionOr<double> resolve_iso_month(GlobalObject& global_object, Object if (month_code.is_undefined()) { // a. If month is undefined, throw a TypeError exception. if (month.is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.month.as_string()); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, vm.names.month.as_string()); // b. Assert: Type(month) is Number. VERIFY(month.is_number()); @@ -701,7 +701,7 @@ ThrowCompletionOr<double> resolve_iso_month(GlobalObject& global_object, Object // 7. If monthLength is not 3, throw a RangeError exception. if (month_length != 3) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode); // 8. Let numberPart be the substring of monthCode from 1. auto number_part = month_code_string.substring(1); @@ -711,18 +711,18 @@ ThrowCompletionOr<double> resolve_iso_month(GlobalObject& global_object, Object // 10. If numberPart < 1 or numberPart > 12, throw a RangeError exception. if (number_part_integer < 1 || number_part_integer > 12) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode); // 11. If month is not undefined and month โ numberPart, then if (!month.is_undefined() && month.as_double() != number_part_integer) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode); } // 12. If SameValueNonNumeric(monthCode, ! BuildISOMonthCode(numberPart)) is false, then if (month_code_string != build_iso_month_code(number_part_integer)) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidMonthCode); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidMonthCode); } // 13. Return numberPart. @@ -815,7 +815,7 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(GlobalObject& global_ob // 7. If month is not undefined, and monthCode and year are both undefined, then if (!month_value.is_undefined() && month_code.is_undefined() && year.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, "monthCode or year"); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, "monthCode or year"); } // 8. Set month to ? ResolveISOMonth(fields). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp index 9361321e1a..47fd73d3ae 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp @@ -38,7 +38,7 @@ ThrowCompletionOr<Value> CalendarConstructor::call() // 1. If NewTarget is undefined, then // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.Calendar"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.Calendar"); } // 12.2.1 Temporal.Calendar ( id ), https://tc39.es/proposal-temporal/#sec-temporal.calendar @@ -53,7 +53,7 @@ ThrowCompletionOr<Object*> CalendarConstructor::construct(FunctionObject& new_ta // 3. If IsBuiltinCalendar(id) is false, then if (!is_builtin_calendar(identifier)) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarIdentifier, identifier); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, identifier); } // 4. Return ? CreateTemporalCalendar(id, NewTarget). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index d4a1878c2b..0690c7c4db 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, fields.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(global_object, vm.argument(1))); @@ -113,7 +113,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, fields.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(global_object, vm.argument(1))); @@ -139,7 +139,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, fields.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(global_object, vm.argument(1))); @@ -257,7 +257,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month) // 4. If Type(temporalDateLike) is Object and temporalDateLike has an [[InitializedTemporalMonthDay]] internal slot, then if (temporal_date_like.is_object() && is<PlainMonthDay>(temporal_date_like.as_object())) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalAmbiguousMonthOfPlainMonthDay); + return vm.throw_completion<TypeError>(ErrorType::TemporalAmbiguousMonthOfPlainMonthDay); } // 5. If Type(temporalDateLike) is not Object or temporalDateLike does not have an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], or [[InitializedTemporalYearMonth]] internal slot, then @@ -534,7 +534,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) // ii. If Type(nextValue) is not String, then if (!next_value.is_string()) { // 1. Let completion be ThrowCompletion(a newly created TypeError object). - auto completion = vm.throw_completion<TypeError>(global_object, ErrorType::TemporalInvalidCalendarFieldValue, next_value.to_string_without_side_effects()); + auto completion = vm.throw_completion<TypeError>(ErrorType::TemporalInvalidCalendarFieldValue, next_value.to_string_without_side_effects()); // 2. Return ? IteratorClose(iteratorRecord, completion). return TRY(iterator_close(global_object, iterator_record, move(completion))); @@ -543,7 +543,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) // iii. If fieldNames contains nextValue, then if (field_names.contains_slow(next_value)) { // 1. Let completion be ThrowCompletion(a newly created RangeError object). - auto completion = vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDuplicateCalendarField, next_value.as_string().string()); + auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalDuplicateCalendarField, next_value.as_string().string()); // 2. Return ? IteratorClose(iteratorRecord, completion). return TRY(iterator_close(global_object, iterator_record, move(completion))); @@ -552,7 +552,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) // iv. If nextValue is not one of "year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", then if (!next_value.as_string().string().is_one_of("year"sv, "month"sv, "monthCode"sv, "day"sv, "hour"sv, "minute"sv, "second"sv, "millisecond"sv, "microsecond"sv, "nanosecond"sv)) { // 1. Let completion be ThrowCompletion(a newly created RangeError object). - auto completion = vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarFieldName, next_value.as_string().string()); + auto completion = vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFieldName, next_value.as_string().string()); // 2. Return ? IteratorClose(iteratorRecord, completion). return TRY(iterator_close(global_object, iterator_record, move(completion))); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp index 5b39a6fafb..0737bc6fb2 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp @@ -84,7 +84,7 @@ ThrowCompletionOr<DurationRecord> create_duration_record(GlobalObject& global_ob // 1. If ! IsValidDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) is false, throw a RangeError exception. if (!is_valid_duration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDuration); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDuration); // 2. Return the Record { [[Years]]: โ(๐ฝ(years)), [[Months]]: โ(๐ฝ(months)), [[Weeks]]: โ(๐ฝ(weeks)), [[Days]]: โ(๐ฝ(days)), [[Hours]]: โ(๐ฝ(hours)), [[Minutes]]: โ(๐ฝ(minutes)), [[Seconds]]: โ(๐ฝ(seconds)), [[Milliseconds]]: โ(๐ฝ(milliseconds)), [[Microseconds]]: โ(๐ฝ(microseconds)), [[Nanoseconds]]: โ(๐ฝ(nanoseconds)) }. return DurationRecord { .years = years, .months = months, .weeks = weeks, .days = days, .hours = hours, .minutes = minutes, .seconds = seconds, .milliseconds = milliseconds, .microseconds = microseconds, .nanoseconds = nanoseconds }; @@ -107,7 +107,7 @@ ThrowCompletionOr<DateDurationRecord> create_date_duration_record(GlobalObject& // 1. If ! IsValidDuration(years, months, weeks, days, 0, 0, 0, 0, 0, 0) is false, throw a RangeError exception. if (!is_valid_duration(years, months, weeks, days, 0, 0, 0, 0, 0, 0)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDuration); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDuration); // 2. Return the Record { [[Years]]: โ(๐ฝ(years)), [[Months]]: โ(๐ฝ(months)), [[Weeks]]: โ(๐ฝ(weeks)), [[Days]]: โ(๐ฝ(days)) }. return DateDurationRecord { .years = years, .months = months, .weeks = weeks, .days = days }; @@ -120,7 +120,7 @@ ThrowCompletionOr<TimeDurationRecord> create_time_duration_record(GlobalObject& // 1. If ! IsValidDuration(0, 0, 0, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) is false, throw a RangeError exception. if (!is_valid_duration(0, 0, 0, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDuration); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDuration); // 2. Return the Record { [[Days]]: โ(๐ฝ(days)), [[Hours]]: โ(๐ฝ(hours)), [[Minutes]]: โ(๐ฝ(minutes)), [[Seconds]]: โ(๐ฝ(seconds)), [[Milliseconds]]: โ(๐ฝ(milliseconds)), [[Microseconds]]: โ(๐ฝ(microseconds)), [[Nanoseconds]]: โ(๐ฝ(nanoseconds)) }. return TimeDurationRecord { .days = days, .hours = hours, .minutes = minutes, .seconds = seconds, .milliseconds = milliseconds, .microseconds = microseconds, .nanoseconds = nanoseconds }; @@ -192,7 +192,7 @@ ThrowCompletionOr<DurationRecord> to_temporal_duration_record(GlobalObject& glob // 6. If ! IsValidDuration(result.[[Years]], result.[[Months]], result.[[Weeks]], result.[[Days]], result.[[Hours]], result.[[Minutes]], result.[[Seconds]], result.[[Milliseconds]], result.[[Microseconds]], result.[[Nanoseconds]]) is false, then if (!is_valid_duration(result.years, result.months, result.weeks, result.days, result.hours, result.minutes, result.seconds, result.milliseconds, result.microseconds, result.nanoseconds)) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDuration); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDuration); } // 7. Return result. @@ -293,7 +293,7 @@ ThrowCompletionOr<PartialDurationRecord> to_temporal_partial_duration_record(Glo // 1. If Type(temporalDurationLike) is not Object, then if (!temporal_duration_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_duration_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_duration_like.to_string_without_side_effects()); } // 2. Let result be a new partial Duration Record with each field set to undefined. @@ -326,7 +326,7 @@ ThrowCompletionOr<PartialDurationRecord> to_temporal_partial_duration_record(Glo // 5. If any is false, then if (!any) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalInvalidDurationLikeObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalInvalidDurationLikeObject); } // 6. Return result. @@ -340,7 +340,7 @@ ThrowCompletionOr<Duration*> create_temporal_duration(GlobalObject& global_objec // 1. If ! IsValidDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) is false, throw a RangeError exception. if (!is_valid_duration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDuration); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDuration); // 2. If newTarget is not present, set newTarget to %Temporal.Duration%. if (!new_target) @@ -617,7 +617,7 @@ ThrowCompletionOr<DateDurationRecord> unbalance_duration_relative(GlobalObject& // a. If calendar is undefined, then if (!calendar) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingStartingPoint, "months"); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingStartingPoint, "months"); } // b. Let dateAdd be ? GetMethod(calendar, "dateAdd"). @@ -658,7 +658,7 @@ ThrowCompletionOr<DateDurationRecord> unbalance_duration_relative(GlobalObject& // a. If calendar is undefined, then if (!calendar) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingStartingPoint, "weeks"); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingStartingPoint, "weeks"); } // b. Repeat, while years โ 0, @@ -698,7 +698,7 @@ ThrowCompletionOr<DateDurationRecord> unbalance_duration_relative(GlobalObject& // i. If calendar is undefined, then if (!calendar) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingStartingPoint, "calendar units"); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingStartingPoint, "calendar units"); } // ii. Repeat, while years โ 0, @@ -767,7 +767,7 @@ ThrowCompletionOr<DateDurationRecord> balance_duration_relative(GlobalObject& gl // 2. If relativeTo is undefined, then if (relative_to_value.is_undefined()) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingStartingPoint, "calendar units"); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingStartingPoint, "calendar units"); } // 3. Let sign be ! DurationSign(years, months, weeks, days, 0, 0, 0, 0, 0, 0). @@ -995,7 +995,7 @@ ThrowCompletionOr<DurationRecord> add_duration(GlobalObject& global_object, doub // a. If largestUnit is one of "year", "month", or "week", then if (largest_unit.is_one_of("year"sv, "month"sv, "week"sv)) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingStartingPoint, "year, month or week"); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingStartingPoint, "year, month or week"); } // b. Let result be ? BalanceDuration(d1 + d2, h1 + h2, min1 + min2, s1 + s2, ms1 + ms2, mus1 + mus2, ns1 + ns2, largestUnit). @@ -1124,7 +1124,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d // 2. If unit is "year", "month", or "week", and relativeTo is undefined, then if (unit.is_one_of("year"sv, "month"sv, "week"sv) && !relative_to_object) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, unit, "smallestUnit"sv); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, unit, "smallestUnit"sv); } // 3. Let zonedRelativeTo be undefined. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp index 04d3c99fa0..d5008cc76f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp @@ -42,7 +42,7 @@ ThrowCompletionOr<Value> DurationConstructor::call() // 1. If NewTarget is undefined, then // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.Duration"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.Duration"); } // 7.1.1 Temporal.Duration ( [ years [ , months [ , weeks [ , days [ , hours [ , minutes [ , seconds [ , milliseconds [ , microseconds [ , nanoseconds ] ] ] ] ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.duration diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp index dabc0c9756..da6a4b548d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/DurationPrototype.cpp @@ -331,7 +331,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round) // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); } Object* round_to; @@ -396,12 +396,12 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round) // 15. If smallestUnitPresent is false and largestUnitPresent is false, then if (!smallest_unit_present && !largest_unit_present) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalMissingUnits); + return vm.throw_completion<RangeError>(ErrorType::TemporalMissingUnits); } // 16. If LargerOfTwoTemporalUnits(largestUnit, smallestUnit) is not largestUnit, throw a RangeError exception. if (larger_of_two_temporal_units(*largest_unit, *smallest_unit) != largest_unit) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidUnitRange, *smallest_unit, *largest_unit); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidUnitRange, *smallest_unit, *largest_unit); // 17. Let roundingMode be ? ToTemporalRoundingMode(roundTo, "halfExpand"). auto rounding_mode = TRY(to_temporal_rounding_mode(global_object, *round_to, "halfExpand"sv)); @@ -454,7 +454,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::total) // 3. If totalOf is undefined, throw a TypeError exception. if (vm.argument(0).is_undefined()) - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); Object* total_of; @@ -578,7 +578,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_string) // 5. If precision.[[Unit]] is "minute", throw a RangeError exception. if (precision.unit == "minute"sv) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, "minute"sv, "smallestUnit"sv); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, "minute"sv, "smallestUnit"sv); // 6. Let roundingMode be ? ToTemporalRoundingMode(options, "trunc"). auto rounding_mode = TRY(to_temporal_rounding_mode(global_object, *options, "trunc"sv)); @@ -617,7 +617,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::to_locale_string) JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.Duration", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.Duration", "a primitive value"); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp index 35d34efc06..8f423a8cf3 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp @@ -127,7 +127,7 @@ ThrowCompletionOr<BigInt*> parse_temporal_instant(GlobalObject& global_object, S // 8. If ! IsValidEpochNanoseconds(result) is false, then if (!is_valid_epoch_nanoseconds(*result_ns)) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); } // 9. Return result. @@ -169,7 +169,7 @@ ThrowCompletionOr<BigInt*> add_instant(GlobalObject& global_object, BigInt const // 2. If ! IsValidEpochNanoseconds(result) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*result)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 3. Return result. return result; @@ -314,19 +314,19 @@ ThrowCompletionOr<Instant*> add_duration_to_or_subtract_duration_from_instant(Gl // 3. If duration.[[Days]] is not 0, throw a RangeError exception. if (duration.days != 0) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationPropertyValueNonZero, "days", duration.days); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationPropertyValueNonZero, "days", duration.days); // 4. If duration.[[Months]] is not 0, throw a RangeError exception. if (duration.months != 0) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationPropertyValueNonZero, "months", duration.months); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationPropertyValueNonZero, "months", duration.months); // 5. If duration.[[Weeks]] is not 0, throw a RangeError exception. if (duration.weeks != 0) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationPropertyValueNonZero, "weeks", duration.weeks); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationPropertyValueNonZero, "weeks", duration.weeks); // 6. If duration.[[Years]] is not 0, throw a RangeError exception. if (duration.years != 0) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidDurationPropertyValueNonZero, "years", duration.years); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationPropertyValueNonZero, "years", duration.years); // 7. Let ns be ? AddInstant(instant.[[Nanoseconds]], sign ร duration.[[Hours]], sign ร duration.[[Minutes]], sign ร duration.[[Seconds]], sign ร duration.[[Milliseconds]], sign ร duration.[[Microseconds]], sign ร duration.[[Nanoseconds]]). auto* ns = TRY(add_instant(global_object, instant.nanoseconds(), sign * duration.hours, sign * duration.minutes, sign * duration.seconds, sign * duration.milliseconds, sign * duration.microseconds, sign * duration.nanoseconds)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp index ee1c94200c..caef8ae4b3 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp @@ -45,7 +45,7 @@ ThrowCompletionOr<Value> InstantConstructor::call() // 1. If NewTarget is undefined, then // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.Instant"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.Instant"); } // 8.1.1 Temporal.Instant ( epochNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal.instant @@ -59,7 +59,7 @@ ThrowCompletionOr<Object*> InstantConstructor::construct(FunctionObject& new_tar // 3. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 4. Return ? CreateTemporalInstant(epochNanoseconds, NewTarget). return TRY(create_temporal_instant(global_object, *epoch_nanoseconds, &new_target)); @@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantConstructor::from_epoch_seconds) // 4. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 5. Return ! CreateTemporalInstant(epochNanoseconds). return MUST(create_temporal_instant(global_object, *epoch_nanoseconds)); @@ -114,7 +114,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantConstructor::from_epoch_milliseconds) // 4. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 5. Return ! CreateTemporalInstant(epochNanoseconds). return MUST(create_temporal_instant(global_object, *epoch_nanoseconds)); @@ -131,7 +131,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantConstructor::from_epoch_microseconds) // 3. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 4. Return ! CreateTemporalInstant(epochNanoseconds). return MUST(create_temporal_instant(global_object, *epoch_nanoseconds)); @@ -145,7 +145,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantConstructor::from_epoch_nanoseconds) // 2. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 3. Return ! CreateTemporalInstant(epochNanoseconds). return MUST(create_temporal_instant(global_object, *epoch_nanoseconds)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp index 885e49eff2..937025f054 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/InstantPrototype.cpp @@ -184,7 +184,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::round) // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); } Object* round_to; @@ -210,7 +210,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::round) // 6. If smallestUnit is undefined, throw a RangeError exception. if (!smallest_unit_value.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::OptionIsNotValidValue, vm.names.undefined.as_string(), "smallestUnit"); + return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, vm.names.undefined.as_string(), "smallestUnit"); // At this point smallest_unit_value can only be a string auto& smallest_unit = *smallest_unit_value; @@ -342,7 +342,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.Instant", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.Instant", "a primitive value"); } // 8.3.17 Temporal.Instant.prototype.toZonedDateTime ( item ), https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tozoneddatetime @@ -357,7 +357,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 3. If Type(item) is not Object, then if (!item.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, item); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, item); } // 4. Let calendarLike be ? Get(item, "calendar"). @@ -366,7 +366,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 5. If calendarLike is undefined, then if (calendar_like.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.calendar.as_string()); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, vm.names.calendar.as_string()); } // 6. Let calendar be ? ToTemporalCalendar(calendarLike). @@ -378,7 +378,7 @@ JS_DEFINE_NATIVE_FUNCTION(InstantPrototype::to_zoned_date_time) // 8. If temporalTimeZoneLike is undefined, then if (temporal_time_zone_like.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.timeZone.as_string()); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, vm.names.timeZone.as_string()); } // 9. Let timeZone be ? ToTemporalTimeZone(temporalTimeZoneLike). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp index 602f6e03eb..5130e68804 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp @@ -59,11 +59,11 @@ ThrowCompletionOr<PlainDate*> create_temporal_date(GlobalObject& global_object, // 5. If IsValidISODate(isoYear, isoMonth, isoDay) is false, throw a RangeError exception. if (!is_valid_iso_date(iso_year, iso_month, iso_day)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); // 6. If ISODateTimeWithinLimits(isoYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0) is false, throw a RangeError exception. if (!iso_date_time_within_limits(global_object, iso_year, iso_month, iso_day, 12, 0, 0, 0, 0, 0)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); // 7. If newTarget is not present, set newTarget to %Temporal.PlainDate%. if (!new_target) @@ -322,7 +322,7 @@ ThrowCompletionOr<ISODateRecord> regulate_iso_date(GlobalObject& global_object, // does not change the exposed behavior as the parent's call to CreateTemporalDate will immediately check that this value is a valid // ISO value for years: -273975 - 273975, which is a subset of this check. if (!AK::is_within_range<i32>(year)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); // a. Set month to the result of clamping month between 1 and 12. month = clamp(month, 1, 12); @@ -345,14 +345,14 @@ ThrowCompletionOr<ISODateRecord> regulate_iso_date(GlobalObject& global_object, // This does not change the exposed behavior as the call to IsValidISODate will immediately check that these values are valid ISO // values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check. if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month) || !AK::is_within_range<u8>(day)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); auto y = static_cast<i32>(year); auto m = static_cast<u8>(month); auto d = static_cast<u8>(day); // b. If IsValidISODate(year, month, day) is false, throw a RangeError exception. if (!is_valid_iso_date(y, m, d)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); // c. Return the Record { [[Year]]: year, [[Month]]: month, [[Day]]: day }. return ISODateRecord { .year = y, .month = m, .day = d }; @@ -512,7 +512,7 @@ ThrowCompletionOr<Duration*> difference_temporal_plain_date(GlobalObject& global // 3. If ? CalendarEquals(temporalDate.[[Calendar]], other.[[Calendar]]) is false, throw a RangeError exception. if (!TRY(calendar_equals(global_object, temporal_date.calendar(), other->calendar()))) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDifferentCalendars); + return vm.throw_completion<RangeError>(ErrorType::TemporalDifferentCalendars); // 4. Let settings be ? GetDifferenceSettings(operation, options, date, ยซ ยป, "day", "day"). auto settings = TRY(get_difference_settings(global_object, operation, options_value, UnitGroup::Date, {}, { "day"sv }, "day"sv)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp index f5f6f56577..84378b3808 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp @@ -42,7 +42,7 @@ ThrowCompletionOr<Value> PlainDateConstructor::call() auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.PlainDate"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.PlainDate"); } // 3.1.1 Temporal.PlainDate ( isoYear, isoMonth, isoDay [ , calendarLike ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindate @@ -67,7 +67,7 @@ ThrowCompletionOr<Object*> PlainDateConstructor::construct(FunctionObject& new_t // This does not change the exposed behavior as the call to CreateTemporalDate will immediately check that these values are valid // ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check. if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDate); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDate); // 6. Return ? CreateTemporalDate(y, m, d, calendar, NewTarget). return TRY(create_temporal_date(global_object, y, m, d, *calendar, &new_target)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index 209ec8a254..27044069ce 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -393,7 +393,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with) // 3. If Type(temporalDateLike) is not Object, then if (!temporal_date_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_date_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_date_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateLike). @@ -619,7 +619,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainDate", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.PlainDate", "a primitive value"); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp index 753a72acb5..1e6302a02a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp @@ -238,16 +238,16 @@ ThrowCompletionOr<PlainDateTime*> create_temporal_date_time(GlobalObject& global // 3. If IsValidISODate(isoYear, isoMonth, isoDay) is false, throw a RangeError exception. if (!is_valid_iso_date(iso_year, iso_month, iso_day)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDateTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDateTime); // 4. If IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is false, throw a RangeError exception. if (!is_valid_time(hour, minute, second, millisecond, microsecond, nanosecond)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDateTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDateTime); // 5. If ISODateTimeWithinLimits(isoYear, isoMonth, isoDay, hour, minute, second, millisecond, microsecond, nanosecond) is false, then if (!iso_date_time_within_limits(global_object, iso_year, iso_month, iso_day, hour, minute, second, millisecond, microsecond, nanosecond)) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDateTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDateTime); } // 6. If newTarget is not present, set newTarget to %Temporal.PlainDateTime%. @@ -422,7 +422,7 @@ ThrowCompletionOr<Duration*> difference_temporal_plain_date_time(GlobalObject& g // 3. If ? CalendarEquals(dateTime.[[Calendar]], other.[[Calendar]]) is false, throw a RangeError exception. if (!TRY(calendar_equals(global_object, date_time.calendar(), other->calendar()))) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDifferentCalendars); + return vm.throw_completion<RangeError>(ErrorType::TemporalDifferentCalendars); // 4. Let settings be ? GetDifferenceSettings(operation, options, datetime, ยซ ยป, "nanosecond", "day"). auto settings = TRY(get_difference_settings(global_object, operation, options_value, UnitGroup::DateTime, {}, { "nanosecond"sv }, "day"sv)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp index 156809f13f..e2d3e0b97b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp @@ -42,7 +42,7 @@ ThrowCompletionOr<Value> PlainDateTimeConstructor::call() auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.PlainDateTime"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.PlainDateTime"); } // 5.1.1 Temporal.PlainDateTime ( isoYear, isoMonth, isoDay [ , hour [ , minute [ , second [ , millisecond [ , microsecond [ , nanosecond [ , calendarLike ] ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime @@ -86,7 +86,7 @@ ThrowCompletionOr<Object*> PlainDateTimeConstructor::construct(FunctionObject& n // ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31, for hours: 0 - 23, for minutes and seconds: 0 - 59, // milliseconds, microseconds, and nanoseconds: 0 - 999) all of which are subsets of this check. if (!AK::is_within_range<i32>(iso_year) || !AK::is_within_range<u8>(iso_month) || !AK::is_within_range<u8>(iso_day) || !AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainDateTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainDateTime); // 12. Return ? CreateTemporalDateTime(isoYear, isoMonth, isoDay, hour, minute, second, millisecond, microsecond, nanosecond, calendar, NewTarget). return TRY(create_temporal_date_time(global_object, iso_year, iso_month, iso_day, hour, minute, second, millisecond, microsecond, nanosecond, *calendar, &new_target)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index b464fa3da3..0e77a336ec 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -365,7 +365,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with) // 3. If Type(temporalDateTimeLike) is not Object, then if (!temporal_date_time_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_date_time_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_date_time_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateTimeLike). @@ -526,7 +526,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::round) // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); } Object* round_to; @@ -637,7 +637,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainDateTime", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.PlainDateTime", "a primitive value"); } // 5.3.36 Temporal.PlainDateTime.prototype.toZonedDateTime ( temporalTimeZoneLike [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.tozoneddatetime diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp index fbf8d44b25..1642f71884 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp @@ -153,11 +153,11 @@ ThrowCompletionOr<PlainMonthDay*> create_temporal_month_day(GlobalObject& global // 3. If IsValidISODate(referenceISOYear, isoMonth, isoDay) is false, throw a RangeError exception. if (!is_valid_iso_date(reference_iso_year, iso_month, iso_day)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainMonthDay); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainMonthDay); // 4. If ISODateTimeWithinLimits(referenceISOYear, isoMonth, isoDay, 12, 0, 0, 0, 0, 0) is false, throw a RangeError exception. if (!iso_date_time_within_limits(global_object, reference_iso_year, iso_month, iso_day, 12, 0, 0, 0, 0, 0)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainMonthDay); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainMonthDay); // 5. If newTarget is not present, set newTarget to %Temporal.PlainMonthDay%. if (!new_target) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp index ba4145c10c..581249b176 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp @@ -40,7 +40,7 @@ ThrowCompletionOr<Value> PlainMonthDayConstructor::call() auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.PlainMonthDay"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.PlainMonthDay"); } // 10.1.1 Temporal.PlainMonthDay ( isoMonth, isoDay [ , calendarLike [ , referenceISOYear ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday @@ -76,7 +76,7 @@ ThrowCompletionOr<Object*> PlainMonthDayConstructor::construct(FunctionObject& n // This does not change the exposed behavior as the call to CreateTemporalMonthDay will immediately check that these values are valid // ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check. if (!AK::is_within_range<i32>(ref) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(d)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainMonthDay); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainMonthDay); // 7. Return ? CreateTemporalMonthDay(m, d, calendar, ref, NewTarget). return TRY(create_temporal_month_day(global_object, m, d, *calendar, ref, &new_target)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index cedb15a93b..3a775b77ca 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -95,7 +95,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with) // 3. If Type(temporalMonthDayLike) is not Object, then if (!temporal_month_day_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_month_day_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_month_day_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalMonthDayLike). @@ -196,7 +196,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainMonthDay", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.PlainMonthDay", "a primitive value"); } // 10.3.12 Temporal.PlainMonthDay.prototype.toPlainDate ( item ), https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.toplaindate @@ -213,7 +213,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::to_plain_date) // 3. If Type(item) is not Object, then if (!item.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, item); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, item); } // 4. Let calendar be monthDay.[[Calendar]]. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp index a25e5583a1..309fb75d84 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp @@ -123,7 +123,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(GlobalObject& global_object, Valu auto calendar_identifier = TRY(Value(calendar).to_string(global_object)); if (calendar_identifier != "iso8601"sv) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarIdentifier, calendar_identifier); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, calendar_identifier); } // f. Let result be ? ToTemporalTimeRecord(item). @@ -146,7 +146,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(GlobalObject& global_object, Valu // d. If result.[[Calendar]] is not one of undefined or "iso8601", then if (result->calendar.has_value() && *result->calendar != "iso8601"sv) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidCalendarIdentifier, *result->calendar); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, *result->calendar); } } @@ -177,7 +177,7 @@ ThrowCompletionOr<TemporalTime> regulate_time(GlobalObject& global_object, doubl // b. If IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is false, throw a RangeError exception. if (!is_valid_time(hour, minute, second, millisecond, microsecond, nanosecond)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainTime); // c. Return the Record { [[Hour]]: hour, [[Minute]]: minute, [[Second]]: second, [[Millisecond]]: millisecond, [[Microsecond]]: microsecond, [[Nanosecond]]: nanosecond }. return TemporalTime { .hour = static_cast<u8>(hour), .minute = static_cast<u8>(minute), .second = static_cast<u8>(second), .millisecond = static_cast<u16>(millisecond), .microsecond = static_cast<u16>(microsecond), .nanosecond = static_cast<u16>(nanosecond) }; @@ -317,7 +317,7 @@ ThrowCompletionOr<PlainTime*> create_temporal_time(GlobalObject& global_object, // 2. If IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is false, throw a RangeError exception. if (!is_valid_time(hour, minute, second, millisecond, microsecond, nanosecond)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainTime); // 3. If newTarget is not present, set newTarget to %Temporal.PlainTime%. if (!new_target) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp index 0955cc7bf2..34f5feda96 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp @@ -40,7 +40,7 @@ ThrowCompletionOr<Value> PlainTimeConstructor::call() auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.PlainTime"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.PlainTime"); } // 4.1.1 Temporal.PlainTime ( [ hour [ , minute [ , second [ , millisecond [ , microsecond [ , nanosecond ] ] ] ] ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plaintime @@ -72,7 +72,7 @@ ThrowCompletionOr<Object*> PlainTimeConstructor::construct(FunctionObject& new_t // ISO values (for hours: 0 - 23, for minutes and seconds: 0 - 59, milliseconds, microseconds, and nanoseconds: 0 - 999) all of which // are subsets of this check. if (!AK::is_within_range<u8>(hour) || !AK::is_within_range<u8>(minute) || !AK::is_within_range<u8>(second) || !AK::is_within_range<u16>(millisecond) || !AK::is_within_range<u16>(microsecond) || !AK::is_within_range<u16>(nanosecond)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainTime); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainTime); // 8. Return ? CreateTemporalTime(hour, minute, second, millisecond, microsecond, nanosecond, NewTarget). return TRY(create_temporal_time(global_object, hour, minute, second, millisecond, microsecond, nanosecond, &new_target)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index dff8a34e91..1e196f8349 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::with) // 3. If Type(temporalTimeLike) is not Object, then if (!temporal_time_like_argument.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_time_like_argument.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_time_like_argument.to_string_without_side_effects()); } auto& temporal_time_like = temporal_time_like_argument.as_object(); @@ -274,7 +274,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::round) // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); } Object* round_to; @@ -378,7 +378,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_zoned_date_time) // 3. If Type(item) is not Object, then if (!item.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, item); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, item); } // 4. Let temporalDateLike be ? Get(item, "plainDate"). @@ -387,7 +387,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_zoned_date_time) // 5. If temporalDateLike is undefined, then if (temporal_date_like.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.plainDate.as_string()); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, vm.names.plainDate.as_string()); } // 6. Let temporalDate be ? ToTemporalDate(temporalDateLike). @@ -399,7 +399,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_zoned_date_time) // 8. If temporalTimeZoneLike is undefined, then if (temporal_time_zone_like.is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::MissingRequiredProperty, vm.names.timeZone.as_string()); + return vm.throw_completion<TypeError>(ErrorType::MissingRequiredProperty, vm.names.timeZone.as_string()); } // 9. Let timeZone be ? ToTemporalTimeZone(temporalTimeZoneLike). @@ -504,7 +504,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainTime", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.PlainTime", "a primitive value"); } } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp index a97464d724..62b8064cd8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp @@ -101,7 +101,7 @@ ThrowCompletionOr<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_obj // values (for years: -273975 - 273975) which is a subset of this check. // If RegulateISOYearMonth is ever used outside ISOYearMonthFromFields, this may need to be changed. if (!AK::is_within_range<i32>(year)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // a. Set month to the result of clamping month between 1 and 12. month = clamp(month, 1, 12); @@ -118,11 +118,11 @@ ThrowCompletionOr<ISOYearMonth> regulate_iso_year_month(GlobalObject& global_obj // This does not change the exposed behavior as the call to IsValidISOMonth and subsequent call to CreateTemporalDateTime will check // that these values are valid ISO values (for years: -273975 - 273975, for months: 1 - 12) all of which are subsets of this check. if (!AK::is_within_range<i32>(year) || !AK::is_within_range<u8>(month)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // b. If ! IsValidISOMonth(month) is false, throw a RangeError exception. if (!is_valid_iso_month(month)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // c. Return the Record { [[Year]]: year, [[Month]]: month }. return ISOYearMonth { .year = static_cast<i32>(year), .month = static_cast<u8>(month), .reference_iso_day = 0 }; @@ -196,11 +196,11 @@ ThrowCompletionOr<PlainYearMonth*> create_temporal_year_month(GlobalObject& glob // 3. If IsValidISODate(isoYear, isoMonth, referenceISODay) is false, throw a RangeError exception. if (!is_valid_iso_date(iso_year, iso_month, reference_iso_day)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // 4. If ! ISOYearMonthWithinLimits(isoYear, isoMonth) is false, throw a RangeError exception. if (!iso_year_month_within_limits(iso_year, iso_month)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // 5. If newTarget is not present, set newTarget to %Temporal.PlainYearMonth%. if (!new_target) @@ -262,7 +262,7 @@ ThrowCompletionOr<Duration*> difference_temporal_plain_year_month(GlobalObject& // 4. If ? CalendarEquals(calendar, other.[[Calendar]]) is false, throw a RangeError exception. if (!TRY(calendar_equals(global_object, calendar, other->calendar()))) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDifferentCalendars); + return vm.throw_completion<RangeError>(ErrorType::TemporalDifferentCalendars); // 5. Let settings be ? GetDifferenceSettings(operation, options, date, ยซ "week", "day" ยป, "month", "year"). auto settings = TRY(get_difference_settings(global_object, operation, options_value, UnitGroup::Date, { "week"sv, "day"sv }, { "month"sv }, "year"sv)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp index 8c2d70ed6d..f355ea6701 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp @@ -42,7 +42,7 @@ ThrowCompletionOr<Value> PlainYearMonthConstructor::call() auto& vm = this->vm(); // 1. If NewTarget is undefined, throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.PlainYearMonth"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.PlainYearMonth"); } // 9.1.1 Temporal.PlainYearMonth ( isoYear, isoMonth [ , calendarLike [ , referenceISODay ] ] ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth @@ -78,7 +78,7 @@ ThrowCompletionOr<Object*> PlainYearMonthConstructor::construct(FunctionObject& // This does not change the exposed behavior as the call to CreateTemporalYearMonth will immediately check that these values are valid // ISO values (for years: -273975 - 273975, for months: 1 - 12, for days: 1 - 31) all of which are subsets of this check. if (!AK::is_within_range<i32>(y) || !AK::is_within_range<u8>(m) || !AK::is_within_range<u8>(ref)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidPlainYearMonth); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidPlainYearMonth); // 7. Return ? CreateTemporalYearMonth(y, m, calendar, ref, NewTarget). return TRY(create_temporal_year_month(global_object, y, m, *calendar, ref, &new_target)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index 6db9b315e1..9a02780cbc 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with) // 3. If Type(temporalYearMonthLike) is not Object, then if (!temporal_year_month_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_year_month_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_year_month_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalYearMonthLike). @@ -363,7 +363,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.PlainYearMonth", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.PlainYearMonth", "a primitive value"); } // 9.3.21 Temporal.PlainYearMonth.prototype.toPlainDate ( item ), https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.toplaindate @@ -380,7 +380,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::to_plain_date) // 3. If Type(item) is not Object, then if (!item.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, item); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, item); } // 4. Let calendar be yearMonth.[[Calendar]]. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp index 5e387ab324..f54965a802 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp @@ -271,7 +271,7 @@ ThrowCompletionOr<double> parse_time_zone_offset_string(GlobalObject& global_obj // 2. If parseResult is a List of errors, throw a RangeError exception. if (!parse_result.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::InvalidFormat, "TimeZone offset"); + return vm.throw_completion<RangeError>(ErrorType::InvalidFormat, "TimeZone offset"); // 3. Let each of sign, hours, minutes, seconds, and fSeconds be the source text matched by the respective TimeZoneUTCOffsetSign, TimeZoneUTCOffsetHour, TimeZoneUTCOffsetMinute, TimeZoneUTCOffsetSecond, and TimeZoneUTCOffsetFraction Parse Node contained within parseResult, or an empty sequence of code points if not present. auto sign = parse_result->time_zone_utc_offset_sign; @@ -459,7 +459,7 @@ ThrowCompletionOr<Object*> to_temporal_time_zone(GlobalObject& global_object, Va if (!is_valid_time_zone_numeric_utc_offset_syntax(name)) { // i. If IsValidTimeZoneName(name) is false, throw a RangeError exception. if (!is_valid_time_zone_name(name)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, name); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, name); // ii. Set name to ! CanonicalizeTimeZoneName(name). name = canonicalize_time_zone_name(name); @@ -490,18 +490,18 @@ ThrowCompletionOr<double> get_offset_nanoseconds_for(GlobalObject& global_object // 3. If Type(offsetNanoseconds) is not Number, throw a TypeError exception. if (!offset_nanoseconds_value.is_number()) - return vm.throw_completion<TypeError>(global_object, ErrorType::IsNotA, "Offset nanoseconds value", "number"); + return vm.throw_completion<TypeError>(ErrorType::IsNotA, "Offset nanoseconds value", "number"); // 4. If IsIntegralNumber(offsetNanoseconds) is false, throw a RangeError exception. if (!offset_nanoseconds_value.is_integral_number()) - return vm.throw_completion<RangeError>(global_object, ErrorType::IsNotAn, "Offset nanoseconds value", "integral number"); + return vm.throw_completion<RangeError>(ErrorType::IsNotAn, "Offset nanoseconds value", "integral number"); // 5. Set offsetNanoseconds to โ(offsetNanoseconds). auto offset_nanoseconds = offset_nanoseconds_value.as_double(); // 6. If abs(offsetNanoseconds) > nsPerDay, throw a RangeError exception. if (fabs(offset_nanoseconds) > ns_per_day) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidOffsetNanosecondsValue); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidOffsetNanosecondsValue); // 7. Return offsetNanoseconds. return offset_nanoseconds; @@ -581,7 +581,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ VERIFY(disambiguation == "reject"sv); // d. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDisambiguatePossibleInstantsRejectMoreThanOne); + return vm.throw_completion<RangeError>(ErrorType::TemporalDisambiguatePossibleInstantsRejectMoreThanOne); } // 5. Assert: n = 0. @@ -590,7 +590,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ // 6. If disambiguation is "reject", then if (disambiguation == "reject"sv) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDisambiguatePossibleInstantsRejectZero); + return vm.throw_completion<RangeError>(ErrorType::TemporalDisambiguatePossibleInstantsRejectZero); } // 7. Let epochNanoseconds be GetEpochFromISOParts(dateTime.[[ISOYear]], dateTime.[[ISOMonth]], dateTime.[[ISODay]], dateTime.[[ISOHour]], dateTime.[[ISOMinute]], dateTime.[[ISOSecond]], dateTime.[[ISOMillisecond]], dateTime.[[ISOMicrosecond]], dateTime.[[ISONanosecond]]). @@ -601,7 +601,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ // 9. If ! IsValidEpochNanoseconds(dayBeforeNs) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*day_before_ns)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 10. Let dayBefore be ! CreateTemporalInstant(dayBeforeNs). auto* day_before = MUST(create_temporal_instant(global_object, *day_before_ns)); @@ -611,7 +611,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ // 12. If ! IsValidEpochNanoseconds(dayAfterNs) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*day_after_ns)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 13. Let dayAfter be ! CreateTemporalInstant(dayAfterNs). auto* day_after = MUST(create_temporal_instant(global_object, *day_after_ns)); @@ -638,7 +638,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ // d. If possibleInstants is empty, throw a RangeError exception. if (possible_instants_.is_empty()) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDisambiguatePossibleInstantsEarlierZero); + return vm.throw_completion<RangeError>(ErrorType::TemporalDisambiguatePossibleInstantsEarlierZero); // e. Return possibleInstants[0]. return possible_instants_[0]; @@ -661,7 +661,7 @@ ThrowCompletionOr<Instant*> disambiguate_possible_instants(GlobalObject& global_ // 23. If n = 0, throw a RangeError exception. if (n == 0) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDisambiguatePossibleInstantsZero); + return vm.throw_completion<RangeError>(ErrorType::TemporalDisambiguatePossibleInstantsZero); // 24. Return possibleInstants[n - 1]. return possible_instants_[n - 1]; @@ -699,7 +699,7 @@ ThrowCompletionOr<MarkedVector<Instant*>> get_possible_instants_for(GlobalObject // ii. If Type(nextValue) is not Object or nextValue does not have an [[InitializedTemporalInstant]] internal slot, then if (!next_value.is_object() || !is<Instant>(next_value.as_object())) { // 1. Let completion be ThrowCompletion(a newly created TypeError object). - auto completion = vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Temporal.Instant"); + auto completion = vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Temporal.Instant"); // 2. Return ? IteratorClose(iteratorRecord, completion). return iterator_close(global_object, iterator, move(completion)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp index eac3857367..e733475a0f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp @@ -38,7 +38,7 @@ ThrowCompletionOr<Value> TimeZoneConstructor::call() // 1. If NewTarget is undefined, then // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.TimeZone"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.TimeZone"); } // 11.2.1 Temporal.TimeZone ( identifier ), https://tc39.es/proposal-temporal/#sec-temporal.timezone @@ -56,7 +56,7 @@ ThrowCompletionOr<Object*> TimeZoneConstructor::construct(FunctionObject& new_ta // a. If IsValidTimeZoneName(identifier) is false, then if (!is_valid_time_zone_name(identifier)) { // i. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, identifier); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, identifier); } // b. Set identifier to ! CanonicalizeTimeZoneName(identifier). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp index c86d55dbeb..5366748203 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZonePrototype.cpp @@ -161,7 +161,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for) for (auto& epoch_nanoseconds : possible_epoch_nanoseconds) { // a. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // b. Let instant be ! CreateTemporalInstant(epochNanoseconds). auto* instant = MUST(create_temporal_instant(global_object, *epoch_nanoseconds)); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp index 769376fb70..f4293acc4d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp @@ -69,7 +69,7 @@ ThrowCompletionOr<BigInt const*> interpret_iso_date_time_offset(GlobalObject& gl // c. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // d. Return epochNanoseconds. return epoch_nanoseconds; @@ -110,7 +110,7 @@ ThrowCompletionOr<BigInt const*> interpret_iso_date_time_offset(GlobalObject& gl // 9. If offsetOption is "reject", throw a RangeError exception. if (offset_option == "reject"sv) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidZonedDateTimeOffset); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidZonedDateTimeOffset); // 10. Let instant be ? DisambiguatePossibleInstants(possibleInstants, timeZone, dateTime, disambiguation). auto* instant = TRY(disambiguate_possible_instants(global_object, possible_instants, time_zone, *date_time, disambiguation)); @@ -210,7 +210,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(GlobalObject& glob if (!is_valid_time_zone_numeric_utc_offset_syntax(*time_zone_name)) { // i. If IsValidTimeZoneName(timeZoneName) is false, throw a RangeError exception. if (!is_valid_time_zone_name(*time_zone_name)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidTimeZoneName, *time_zone_name); // ii. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName). time_zone_name = canonicalize_time_zone_name(*time_zone_name); @@ -489,7 +489,7 @@ ThrowCompletionOr<NanosecondsToDaysResult> nanoseconds_to_days(GlobalObject& glo // 9. If ! IsValidEpochNanoseconds(โค(endNs)) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*end_ns_bigint)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 10. Let endInstant be ! CreateTemporalInstant(โค(endNs)). auto* end_instant = MUST(create_temporal_instant(global_object, *end_ns_bigint)); @@ -566,7 +566,7 @@ ThrowCompletionOr<Duration*> difference_temporal_zoned_date_time(GlobalObject& g // 3. If ? CalendarEquals(zonedDateTime.[[Calendar]], other.[[Calendar]]) is false, then if (!TRY(calendar_equals(global_object, zoned_date_time.calendar(), other->calendar()))) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDifferentCalendars); + return vm.throw_completion<RangeError>(ErrorType::TemporalDifferentCalendars); } // 4. Let settings be ? GetDifferenceSettings(operation, options, datetime, ยซ ยป, "nanosecond", "hour"). @@ -589,7 +589,7 @@ ThrowCompletionOr<Duration*> difference_temporal_zoned_date_time(GlobalObject& g // 6. If ? TimeZoneEquals(zonedDateTime.[[TimeZone]], other.[[TimeZone]]) is false, then if (!TRY(time_zone_equals(global_object, zoned_date_time.time_zone(), other->time_zone()))) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalDifferentTimeZones); + return vm.throw_completion<RangeError>(ErrorType::TemporalDifferentTimeZones); } // 7. Let untilOptions be ? MergeLargestUnitOption(settings.[[Options]], settings.[[LargestUnit]]). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp index 4873aa18f4..0ffd136e0f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp @@ -44,7 +44,7 @@ ThrowCompletionOr<Value> ZonedDateTimeConstructor::call() // 1. If NewTarget is undefined, then // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object(), ErrorType::ConstructorWithoutNew, "Temporal.ZonedDateTime"); + return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, "Temporal.ZonedDateTime"); } // 6.1.1 Temporal.ZonedDateTime ( epochNanoseconds, timeZoneLike [ , calendarLike ] ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime @@ -58,7 +58,7 @@ ThrowCompletionOr<Object*> ZonedDateTimeConstructor::construct(FunctionObject& n // 3. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception. if (!is_valid_epoch_nanoseconds(*epoch_nanoseconds)) - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalInvalidEpochNanoseconds); + return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidEpochNanoseconds); // 4. Let timeZone be ? ToTemporalTimeZone(timeZoneLike). auto* time_zone = TRY(to_temporal_time_zone(global_object, vm.argument(1))); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index 4390d0f46e..75696d997c 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -729,7 +729,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with) // 3. If Type(temporalZonedDateTimeLike) is not Object, then if (!temporal_zoned_date_time_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObject, temporal_zoned_date_time_like.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_zoned_date_time_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalZonedDateTimeLike). @@ -960,7 +960,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round) // 3. If roundTo is undefined, then if (vm.argument(0).is_undefined()) { // a. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalMissingOptionsObject); + return vm.throw_completion<TypeError>(ErrorType::TemporalMissingOptionsObject); } Object* round_to; @@ -1023,7 +1023,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round) // 19. If dayLengthNs โค 0, then if (day_length_ns <= 0) { // a. Throw a RangeError exception. - return vm.throw_completion<RangeError>(global_object, ErrorType::TemporalZonedDateTimeRoundZeroOrNegativeLengthDay); + return vm.throw_completion<RangeError>(ErrorType::TemporalZonedDateTimeRoundZeroOrNegativeLengthDay); } // 20. Let roundResult be ! RoundISODateTime(temporalDateTime.[[ISOYear]], temporalDateTime.[[ISOMonth]], temporalDateTime.[[ISODay]], temporalDateTime.[[ISOHour]], temporalDateTime.[[ISOMinute]], temporalDateTime.[[ISOSecond]], temporalDateTime.[[ISOMillisecond]], temporalDateTime.[[ISOMicrosecond]], temporalDateTime.[[ISONanosecond]], roundingIncrement, smallestUnit, roundingMode, dayLengthNs). @@ -1117,7 +1117,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::to_json) JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::value_of) { // 1. Throw a TypeError exception. - return vm.throw_completion<TypeError>(global_object, ErrorType::Convert, "Temporal.ZonedDateTime", "a primitive value"); + return vm.throw_completion<TypeError>(ErrorType::Convert, "Temporal.ZonedDateTime", "a primitive value"); } // 6.3.45 Temporal.ZonedDateTime.prototype.startOfDay ( ), https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.startofday |