LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16

This has quite a lot of fall out. But the majority of it is just type or
UDL substitution, where the changes just fall through to other function
calls.

By changing property key storage to UTF-16, the main affected areas are:
* NativeFunction names must now be UTF-16
* Bytecode identifiers must now be UTF-16
* Module/binding names must now be UTF-16
This commit is contained in:
Timothy Flynn 2025-08-02 19:27:29 -04:00 committed by Tim Flynn
commit 0efa98a57a
Notes: github-actions[bot] 2025-08-05 11:08:30 +00:00
131 changed files with 766 additions and 726 deletions

View file

@ -28,7 +28,7 @@ GC::Ref<PrimitiveString> FunctionObject::make_function_name(Variant<PropertyKey,
{
auto& vm = this->vm();
String name;
Utf16String name;
// 2. If Type(name) is Symbol, then
if (auto const* property_key = name_arg.get_pointer<PropertyKey>(); property_key && property_key->is_symbol()) {
@ -37,15 +37,15 @@ GC::Ref<PrimitiveString> FunctionObject::make_function_name(Variant<PropertyKey,
// b. If description is undefined, set name to the empty String.
if (!description.has_value())
name = ""_string;
name = {};
// c. Else, set name to the string-concatenation of "[", description, and "]".
else
name = MUST(String::formatted("[{}]", *description));
name = Utf16String::formatted("[{}]", *description);
}
// 3. Else if name is a Private Name, then
else if (auto const* private_name = name_arg.get_pointer<PrivateName>()) {
// a. Set name to name.[[Description]].
name = private_name->description.to_string();
name = private_name->description.to_utf16_string();
}
// NOTE: This is necessary as we use a different parameter name.
else {
@ -61,7 +61,7 @@ GC::Ref<PrimitiveString> FunctionObject::make_function_name(Variant<PropertyKey,
// 5. If prefix is present, then
if (prefix.has_value()) {
// a. Set name to the string-concatenation of prefix, the code unit 0x0020 (SPACE), and name.
name = MUST(String::formatted("{} {}", *prefix, name));
name = Utf16String::formatted("{} {}", *prefix, name);
// b. If F has an [[InitialName]] internal slot, then
if (is<NativeFunction>(this)) {