1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +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

@ -323,11 +323,11 @@ String Value::to_string_without_side_effects() const
}
}
PrimitiveString* Value::to_primitive_string(GlobalObject& global_object)
ThrowCompletionOr<PrimitiveString*> Value::to_primitive_string(GlobalObject& global_object)
{
if (is_string())
return &as_string();
auto string = TRY_OR_DISCARD(to_string(global_object));
auto string = TRY(to_string(global_object));
return js_string(global_object.heap(), string);
}