LibJS: Convert to_primitive_string() to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-12 18:05:46 +01:00
commit 96ab116f0d
Notes: sideshowbarker 2024-07-18 02:47:38 +09:00
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);
}