mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 20:29:42 +00:00
LibJS: Add a PrimitiveString::create overload for FlyString
This is to disambiguate this type from the StringView overload.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
2671d4280f
commit
0d0b87fd46
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Utf16View.h>
|
||||
#include <AK/Utf8View.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
@@ -188,6 +189,11 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, String string)
|
||||
return *new_string;
|
||||
}
|
||||
|
||||
NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, FlyString const& string)
|
||||
{
|
||||
return create(vm, string.to_string());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<NonnullGCPtr<PrimitiveString>> PrimitiveString::create(VM& vm, StringView string)
|
||||
{
|
||||
return create(vm, TRY_OR_THROW_OOM(vm, String::from_utf8(string)));
|
||||
|
||||
Reference in New Issue
Block a user