1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:37:35 +00:00

LibJS+Everywhere: Rename Value::to_string to to_deprecated_string

This commit is contained in:
Timothy Flynn 2023-01-13 10:29:02 -05:00 committed by Linus Groh
parent 8f5bdce8e7
commit afeb7273cc
68 changed files with 193 additions and 193 deletions

View file

@ -390,7 +390,7 @@ ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(VM& vm, Ob
// a. If fractionalDigitsVal is not undefined, then
if (!fractional_digits_value.is_undefined()) {
// i. If ? ToString(fractionalDigitsVal) is not "auto", throw a RangeError exception.
if (TRY(fractional_digits_value.to_string(vm)) != "auto"sv)
if (TRY(fractional_digits_value.to_deprecated_string(vm)) != "auto"sv)
return vm.template throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, fractional_digits_value, "fractionalSecondDigits"sv);
}
@ -628,7 +628,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(VM& vm, Object const& optio
// 7. Else,
else {
// a. Let string be ? ToString(value).
auto string = TRY(value.to_string(vm));
auto string = TRY(value.to_deprecated_string(vm));
// b. Let result be ? ParseTemporalRelativeToString(string).
result = TRY(parse_temporal_relative_to_string(vm, string));
@ -690,7 +690,7 @@ ThrowCompletionOr<Value> to_relative_temporal_object(VM& vm, Object const& optio
if (offset_behavior == OffsetBehavior::Option) {
// a. Set offsetString to ? ToString(offsetString).
// NOTE: offsetString is not used after this path, so we don't need to put this into the original offset_string which is of type JS::Value.
auto actual_offset_string = TRY(offset_string.to_string(vm));
auto actual_offset_string = TRY(offset_string.to_deprecated_string(vm));
// b. If IsTimeZoneOffsetString(offsetString) is false, throw a RangeError exception.
if (!is_time_zone_offset_string(actual_offset_string))

View file

@ -238,7 +238,7 @@ ThrowCompletionOr<DeprecatedString> calendar_month_code(VM& vm, Object& calendar
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarFunctionResult, vm.names.monthCode.as_string(), vm.names.undefined.as_string());
// 3. Return ? ToString(result).
return result.to_string(vm);
return result.to_deprecated_string(vm);
}
// 12.2.11 CalendarDay ( calendar, dateLike ), https://tc39.es/proposal-temporal/#sec-temporal-calendarday
@ -387,7 +387,7 @@ ThrowCompletionOr<Value> calendar_era(VM& vm, Object& calendar, Object& date_lik
// 3. If result is not undefined, set result to ? ToString(result).
if (!result.is_undefined())
result = PrimitiveString::create(vm, TRY(result.to_string(vm)));
result = PrimitiveString::create(vm, TRY(result.to_deprecated_string(vm)));
// 4. Return result.
return result;
@ -461,7 +461,7 @@ ThrowCompletionOr<Object*> to_temporal_calendar(VM& vm, Value temporal_calendar_
}
// 2. Let identifier be ? ToString(temporalCalendarLike).
auto identifier = TRY(temporal_calendar_like.to_string(vm));
auto identifier = TRY(temporal_calendar_like.to_deprecated_string(vm));
// 3. Set identifier to ? ParseTemporalCalendarString(identifier).
identifier = TRY(parse_temporal_calendar_string(vm, identifier));
@ -573,7 +573,7 @@ ThrowCompletionOr<DeprecatedString> maybe_format_calendar_annotation(VM& vm, Obj
VERIFY(calendar_object);
// 3. Let calendarID be ? ToString(calendarObject).
auto calendar_id = TRY(Value(calendar_object).to_string(vm));
auto calendar_id = TRY(Value(calendar_object).to_deprecated_string(vm));
// 4. Return FormatCalendarAnnotation(calendarID, showCalendar).
return format_calendar_annotation(calendar_id, show_calendar);
@ -607,10 +607,10 @@ ThrowCompletionOr<bool> calendar_equals(VM& vm, Object& one, Object& two)
return true;
// 2. Let calendarOne be ? ToString(one).
auto calendar_one = TRY(Value(&one).to_string(vm));
auto calendar_one = TRY(Value(&one).to_deprecated_string(vm));
// 3. Let calendarTwo be ? ToString(two).
auto calendar_two = TRY(Value(&two).to_string(vm));
auto calendar_two = TRY(Value(&two).to_deprecated_string(vm));
// 4. If calendarOne is calendarTwo, return true.
if (calendar_one == calendar_two)
@ -628,10 +628,10 @@ ThrowCompletionOr<Object*> consolidate_calendars(VM& vm, Object& one, Object& tw
return &two;
// 2. Let calendarOne be ? ToString(one).
auto calendar_one = TRY(Value(&one).to_string(vm));
auto calendar_one = TRY(Value(&one).to_deprecated_string(vm));
// 3. Let calendarTwo be ? ToString(two).
auto calendar_two = TRY(Value(&two).to_string(vm));
auto calendar_two = TRY(Value(&two).to_deprecated_string(vm));
// 4. If calendarOne is calendarTwo, return two.
if (calendar_one == calendar_two)

View file

@ -47,7 +47,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> CalendarConstructor::construct(FunctionO
auto& vm = this->vm();
// 2. Set id to ? ToString(id).
auto identifier = TRY(vm.argument(0).to_string(vm));
auto identifier = TRY(vm.argument(0).to_deprecated_string(vm));
// 3. If IsBuiltinCalendar(id) is false, then
if (!is_builtin_calendar(identifier)) {

View file

@ -627,7 +627,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::to_json)
auto* calendar = TRY(typed_this_object(vm));
// 3. Return ? ToString(calendar).
return PrimitiveString::create(vm, TRY(Value(calendar).to_string(vm)));
return PrimitiveString::create(vm, TRY(Value(calendar).to_deprecated_string(vm)));
}
// 15.6.2.6 Temporal.Calendar.prototype.era ( temporalDateLike ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.era

View file

@ -143,7 +143,7 @@ ThrowCompletionOr<DurationRecord> to_temporal_duration_record(VM& vm, Value temp
// 1. If Type(temporalDurationLike) is not Object, then
if (!temporal_duration_like.is_object()) {
// a. Let string be ? ToString(temporalDurationLike).
auto string = TRY(temporal_duration_like.to_string(vm));
auto string = TRY(temporal_duration_like.to_deprecated_string(vm));
// b. Return ? ParseTemporalDurationString(string).
return parse_temporal_duration_string(vm, string);

View file

@ -100,7 +100,7 @@ ThrowCompletionOr<Instant*> to_temporal_instant(VM& vm, Value item)
}
// 2. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// 3. Let epochNanoseconds be ? ParseTemporalInstant(string).
auto* epoch_nanoseconds = TRY(parse_temporal_instant(vm, string));

View file

@ -140,7 +140,7 @@ ThrowCompletionOr<PlainDate*> to_temporal_date(VM& vm, Value item, Object const*
(void)TRY(to_temporal_overflow(vm, options));
// 5. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// 6. Let result be ? ParseTemporalDateString(string).
auto result = TRY(parse_temporal_date_string(vm, string));

View file

@ -165,7 +165,7 @@ ThrowCompletionOr<PlainDateTime*> to_temporal_date_time(VM& vm, Value item, Obje
(void)TRY(to_temporal_overflow(vm, options));
// b. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// c. Let result be ? ParseTemporalDateTimeString(string).
result = TRY(parse_temporal_date_time_string(vm, string));

View file

@ -120,7 +120,7 @@ ThrowCompletionOr<PlainMonthDay*> to_temporal_month_day(VM& vm, Value item, Obje
(void)TRY(to_temporal_overflow(vm, options));
// 6. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// 7. Let result be ? ParseTemporalMonthDayString(string).
auto result = TRY(parse_temporal_month_day_string(vm, string));
@ -185,7 +185,7 @@ ThrowCompletionOr<DeprecatedString> temporal_month_day_to_string(VM& vm, PlainMo
auto result = DeprecatedString::formatted("{:02}-{:02}", month_day.iso_month(), month_day.iso_day());
// 6. Let calendarID be ? ToString(monthDay.[[Calendar]]).
auto calendar_id = TRY(Value(&month_day.calendar()).to_string(vm));
auto calendar_id = TRY(Value(&month_day.calendar()).to_deprecated_string(vm));
// 7. If showCalendar is one of "always" or "critical", or if calendarID is not "iso8601", then
if (show_calendar.is_one_of("always"sv, "critical"sv) || calendar_id != "iso8601"sv) {

View file

@ -122,7 +122,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(VM& vm, Value item, Optional<Stri
auto* calendar = TRY(get_temporal_calendar_with_iso_default(vm, item_object));
// e. If ? ToString(calendar) is not "iso8601", then
auto calendar_identifier = TRY(Value(calendar).to_string(vm));
auto calendar_identifier = TRY(Value(calendar).to_deprecated_string(vm));
if (calendar_identifier != "iso8601"sv) {
// i. Throw a RangeError exception.
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarIdentifier, calendar_identifier);
@ -137,7 +137,7 @@ ThrowCompletionOr<PlainTime*> to_temporal_time(VM& vm, Value item, Optional<Stri
// 4. Else,
else {
// a. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// b. Let result be ? ParseTemporalTimeString(string).
result = TRY(parse_temporal_time_string(vm, string));

View file

@ -66,7 +66,7 @@ ThrowCompletionOr<PlainYearMonth*> to_temporal_year_month(VM& vm, Value item, Ob
(void)TRY(to_temporal_overflow(vm, options));
// 5. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// 6. Let result be ? ParseTemporalYearMonthString(string).
auto result = TRY(parse_temporal_year_month_string(vm, string));
@ -212,7 +212,7 @@ ThrowCompletionOr<DeprecatedString> temporal_year_month_to_string(VM& vm, PlainY
auto result = DeprecatedString::formatted("{}-{:02}", pad_iso_year(year_month.iso_year()), year_month.iso_month());
// 6. Let calendarID be ? ToString(yearMonth.[[Calendar]]).
auto calendar_id = TRY(Value(&year_month.calendar()).to_string(vm));
auto calendar_id = TRY(Value(&year_month.calendar()).to_deprecated_string(vm));
// 7. If showCalendar is one of "always" or "critical", or if calendarID is not "iso8601", then
if (show_calendar.is_one_of("always"sv, "critical"sv) || calendar_id != "iso8601") {

View file

@ -332,7 +332,7 @@ ThrowCompletionOr<Object*> to_temporal_time_zone(VM& vm, Value temporal_time_zon
}
// 2. Let identifier be ? ToString(temporalTimeZoneLike).
auto identifier = TRY(temporal_time_zone_like.to_string(vm));
auto identifier = TRY(temporal_time_zone_like.to_deprecated_string(vm));
// 3. Let parseResult be ? ParseTemporalTimeZoneString(identifier).
auto parse_result = TRY(parse_temporal_time_zone_string(vm, identifier));
@ -603,10 +603,10 @@ ThrowCompletionOr<bool> time_zone_equals(VM& vm, Object& one, Object& two)
return true;
// 2. Let timeZoneOne be ? ToString(one).
auto time_zone_one = TRY(Value(&one).to_string(vm));
auto time_zone_one = TRY(Value(&one).to_deprecated_string(vm));
// 3. Let timeZoneTwo be ? ToString(two).
auto time_zone_two = TRY(Value(&two).to_string(vm));
auto time_zone_two = TRY(Value(&two).to_deprecated_string(vm));
// 4. If timeZoneOne is timeZoneTwo, return true.
if (time_zone_one == time_zone_two)

View file

@ -48,7 +48,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> TimeZoneConstructor::construct(FunctionO
auto& vm = this->vm();
// 2. Set identifier to ? ToString(identifier).
auto identifier = TRY(vm.argument(0).to_string(vm));
auto identifier = TRY(vm.argument(0).to_deprecated_string(vm));
// 3. If IsTimeZoneOffsetString(identifier) is false, then
if (!is_time_zone_offset_string(identifier)) {

View file

@ -244,7 +244,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::to_json)
auto* time_zone = TRY(typed_this_object(vm));
// 3. Return ? ToString(timeZone).
return PrimitiveString::create(vm, TRY(Value(time_zone).to_string(vm)));
return PrimitiveString::create(vm, TRY(Value(time_zone).to_deprecated_string(vm)));
}
}

View file

@ -175,7 +175,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
// k. Else,
else {
// i. Set offsetString to ? ToString(offsetString).
offset_string = TRY(offset_string_value.to_string(vm));
offset_string = TRY(offset_string_value.to_deprecated_string(vm));
}
// l. Let result be ? InterpretTemporalDateTimeFields(calendar, fields, options).
@ -187,7 +187,7 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
(void)TRY(to_temporal_overflow(vm, options));
// b. Let string be ? ToString(item).
auto string = TRY(item.to_string(vm));
auto string = TRY(item.to_deprecated_string(vm));
// c. Let result be ? ParseTemporalZonedDateTimeString(string).
result = TRY(parse_temporal_zoned_date_time_string(vm, string));
@ -342,7 +342,7 @@ ThrowCompletionOr<DeprecatedString> temporal_zoned_date_time_to_string(VM& vm, Z
// 13. Else,
else {
// a. Let timeZoneID be ? ToString(timeZone).
auto time_zone_id = TRY(Value(&time_zone).to_string(vm));
auto time_zone_id = TRY(Value(&time_zone).to_deprecated_string(vm));
// b. If showTimeZone is "critical", let flag be "!"; else let flag be the empty String.
auto flag = show_time_zone == "critical"sv ? "!"sv : ""sv;