1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +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

@ -54,7 +54,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::apply)
// 1. 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()));
// 2. Let args be ? CreateListFromArrayLike(argumentsList).
auto args = TRY(create_list_from_array_like(vm, arguments_list));
@ -73,14 +73,14 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::construct)
// 1. If IsConstructor(target) is false, throw a TypeError exception.
if (!target.is_constructor())
return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, target.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects()));
// 2. If newTarget is not present, set newTarget to target.
if (vm.argument_count() < 3)
new_target = target;
// 3. Else if IsConstructor(newTarget) is false, throw a TypeError exception.
else if (!new_target.is_constructor())
return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, new_target.to_deprecated_string_without_side_effects());
return vm.throw_completion<TypeError>(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, new_target.to_string_without_side_effects()));
// 4. Let args be ? CreateListFromArrayLike(argumentsList).
auto args = TRY(create_list_from_array_like(vm, arguments_list));
@ -98,7 +98,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::delete_property)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -136,7 +136,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -159,7 +159,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_own_property_descriptor)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -178,7 +178,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_prototype_of)
// 1. If Type(target) is not 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. Return ? target.[[GetPrototypeOf]]().
return TRY(target.as_object().internal_get_prototype_of());
@ -192,7 +192,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::has)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -208,7 +208,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::is_extensible)
// 1. If Type(target) is not 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. Return ? target.[[IsExtensible]]().
return Value(TRY(target.as_object().internal_is_extensible()));
@ -223,7 +223,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::own_keys)
// 1. If Type(target) is not 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 keys be ? target.[[OwnPropertyKeys]]().
auto keys = TRY(target.as_object().internal_own_property_keys());
@ -239,7 +239,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::prevent_extensions)
// 1. If Type(target) is not 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. Return ? target.[[PreventExtensions]]().
return Value(TRY(target.as_object().internal_prevent_extensions()));
@ -255,7 +255,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set)
// 1. If Type(target) is not 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 key be ? ToPropertyKey(propertyKey).
auto key = TRY(property_key.to_property_key(vm));
@ -278,7 +278,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set_prototype_of)
// 1. If Type(target) is not 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. If Type(proto) is not Object and proto is not null, throw a TypeError exception.
if (!proto.is_object() && !proto.is_null())