1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

LibJS: Convert to_primitive_string() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-12 18:05:46 +01:00
parent da59c77fe3
commit 96ab116f0d
8 changed files with 18 additions and 30 deletions

View file

@ -87,9 +87,7 @@ String JSONObject::stringify_impl(GlobalObject& global_object, Value value, Valu
if (vm.exception())
return {};
} else if (is<StringObject>(space_object)) {
space = space.to_primitive_string(global_object);
if (vm.exception())
return {};
space = TRY_OR_DISCARD(space.to_primitive_string(global_object));
}
}
@ -157,9 +155,7 @@ String JSONObject::serialize_json_property(GlobalObject& global_object, Stringif
if (vm.exception())
return {};
} else if (is<StringObject>(value_object)) {
value = value.to_primitive_string(global_object);
if (vm.exception())
return {};
value = TRY_OR_DISCARD(value.to_primitive_string(global_object));
} else if (is<BooleanObject>(value_object)) {
value = static_cast<BooleanObject&>(value_object).value_of();
} else if (is<BigIntObject>(value_object)) {