mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +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:
parent
2671d4280f
commit
0d0b87fd46
2 changed files with 7 additions and 0 deletions
|
@ -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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue