1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:57:44 +00:00

LbJS: Convert exception-related usages of Value::TDSWOSE to String

TDSWOSE being to_deprecated_string_without_side_effects.
This commit is contained in:
Timothy Flynn 2023-02-12 21:26:14 -05:00 committed by Linus Groh
parent 3ffb6d9b5a
commit a73b8292ed
47 changed files with 125 additions and 123 deletions

View file

@ -62,7 +62,7 @@ ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(VM& vm, Value it
// 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>(ErrorType::IterableToListOfTypeInvalidValue, next_value.to_deprecated_string_without_side_effects());
auto completion = vm.throw_completion<TypeError>(ErrorType::IterableToListOfTypeInvalidValue, TRY_OR_THROW_OOM(vm, next_value.to_string_without_side_effects()));
// 2. Return ? IteratorClose(iteratorRecord, completion).
return iterator_close(vm, iterator_record, move(completion));
}

View file

@ -152,7 +152,7 @@ ThrowCompletionOr<Object*> calendar_merge_fields(VM& vm, Object& calendar, Objec
// 4. If Type(result) is not Object, throw a TypeError exception.
if (!result.is_object())
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, result.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, result.to_string_without_side_effects()));
// 5. Return result.
return &result.as_object();

View file

@ -94,7 +94,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>(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects()));
// 5. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(1)));
@ -120,7 +120,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>(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects()));
// 5. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(1)));
@ -146,7 +146,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>(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects()));
// 5. Set options to ? GetOptionsObject(options).
auto const* options = TRY(get_options_object(vm, vm.argument(1)));
@ -555,7 +555,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>(ErrorType::TemporalInvalidCalendarFieldValue, next_value.to_deprecated_string_without_side_effects());
auto completion = vm.throw_completion<TypeError>(ErrorType::TemporalInvalidCalendarFieldValue, TRY_OR_THROW_OOM(vm, next_value.to_string_without_side_effects()));
// 2. Return ? IteratorClose(iteratorRecord, completion).
return TRY(iterator_close(vm, iterator_record, move(completion)));

View file

@ -305,7 +305,7 @@ ThrowCompletionOr<PartialDurationRecord> to_temporal_partial_duration_record(VM&
// 1. If Type(temporalDurationLike) is not Object, then
if (!temporal_duration_like.is_object()) {
// a. Throw a TypeError exception.
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, temporal_duration_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_duration_like.to_string_without_side_effects()));
}
// 2. Let result be a new partial Duration Record with each field set to undefined.

View file

@ -410,7 +410,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>(ErrorType::NotAnObject, temporal_date_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_date_like.to_string_without_side_effects()));
}
// 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateLike).

View file

@ -382,7 +382,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>(ErrorType::NotAnObject, temporal_date_time_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_date_time_like.to_string_without_side_effects()));
}
// 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateTimeLike).

View file

@ -97,7 +97,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>(ErrorType::NotAnObject, temporal_month_day_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_month_day_like.to_string_without_side_effects()));
}
// 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalMonthDayLike).

View file

@ -176,7 +176,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>(ErrorType::NotAnObject, temporal_time_like_argument.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_time_like_argument.to_string_without_side_effects()));
}
auto& temporal_time_like = temporal_time_like_argument.as_object();

View file

@ -208,7 +208,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>(ErrorType::NotAnObject, temporal_year_month_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_year_month_like.to_string_without_side_effects()));
}
// 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalYearMonthLike).

View file

@ -756,7 +756,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>(ErrorType::NotAnObject, temporal_zoned_date_time_like.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_zoned_date_time_like.to_string_without_side_effects()));
}
// 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalZonedDateTimeLike).