mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibJS: Convert to_primitive_string() to ThrowCompletionOr
This commit is contained in:
parent
da59c77fe3
commit
96ab116f0d
Notes:
sideshowbarker
2024-07-18 02:47:38 +09:00
Author: https://github.com/linusg
Commit: 96ab116f0d
Pull-request: https://github.com/SerenityOS/serenity/pull/10452
Reviewed-by: https://github.com/IdanHo ✅
8 changed files with 18 additions and 30 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue