1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +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

@ -541,7 +541,7 @@ ThrowCompletionOr<Value> Value::to_primitive(VM& vm, PreferredType preferred_typ
return result;
// vi. Throw a TypeError exception.
return vm.throw_completion<TypeError>(ErrorType::ToPrimitiveReturnedObject, to_deprecated_string_without_side_effects(), hint);
return vm.throw_completion<TypeError>(ErrorType::ToPrimitiveReturnedObject, TRY_OR_THROW_OOM(vm, to_string_without_side_effects()), hint);
}
// c. If preferredType is not present, let preferredType be number.
@ -1241,7 +1241,7 @@ ThrowCompletionOr<FunctionObject*> Value::get_method(VM& vm, PropertyKey const&
// 4. If IsCallable(func) is false, throw a TypeError exception.
if (!function.is_function())
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, function.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function.to_string_without_side_effects()));
// 5. Return func.
return &function.as_function();
@ -2058,7 +2058,7 @@ ThrowCompletionOr<Value> instance_of(VM& vm, Value value, Value target)
{
// 1. If target is not an Object, throw a TypeError exception.
if (!target.is_object())
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects()));
// 2. Let instOfHandler be ? GetMethod(target, @@hasInstance).
auto* instance_of_handler = TRY(target.get_method(vm, *vm.well_known_symbol_has_instance()));
@ -2071,7 +2071,7 @@ ThrowCompletionOr<Value> instance_of(VM& vm, Value value, Value target)
// 4. If IsCallable(target) is false, throw a TypeError exception.
if (!target.is_function())
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, target.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects()));
// 5. Return ? OrdinaryHasInstance(target, V).
return ordinary_has_instance(vm, target, value);
@ -2106,7 +2106,7 @@ ThrowCompletionOr<Value> ordinary_has_instance(VM& vm, Value lhs, Value rhs)
// 5. If P is not an Object, throw a TypeError exception.
if (!rhs_prototype.is_object())
return vm.throw_completion<TypeError>(ErrorType::InstanceOfOperatorBadPrototype, rhs.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::InstanceOfOperatorBadPrototype, TRY_OR_THROW_OOM(vm, rhs.to_string_without_side_effects()));
// 6. Repeat,
while (true) {