1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibJS: Replace standalone js_string() with PrimitiveString::create()

Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
This commit is contained in:
Linus Groh 2022-12-06 22:17:27 +00:00
parent 5db38d7ba1
commit 525f22d018
144 changed files with 656 additions and 672 deletions

View file

@ -39,7 +39,7 @@ void Intl::initialize(Realm& realm)
auto& vm = this->vm();
// 8.1.1 Intl[ @@toStringTag ], https://tc39.es/ecma402/#sec-Intl-toStringTag
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, "Intl"), Attribute::Configurable);
define_direct_property(*vm.well_known_symbol_to_string_tag(), PrimitiveString::create(vm, "Intl"), Attribute::Configurable);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_intrinsic_accessor(vm.names.Collator, attr, [](auto& realm) -> Value { return realm.intrinsics().intl_collator_constructor(); });
@ -70,7 +70,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::get_canonical_locales)
MarkedVector<Value> marked_locale_list { vm.heap() };
marked_locale_list.ensure_capacity(locale_list.size());
for (auto& locale : locale_list)
marked_locale_list.append(js_string(vm, move(locale)));
marked_locale_list.append(PrimitiveString::create(vm, move(locale)));
// 2. Return CreateArrayFromList(ll).
return Array::create_from(realm, marked_locale_list);
@ -154,7 +154,7 @@ JS_DEFINE_NATIVE_FUNCTION(Intl::supported_values_of)
}
// 9. Return CreateArrayFromList( list ).
return Array::create_from<StringView>(realm, list, [&](auto value) { return js_string(vm, value); });
return Array::create_from<StringView>(realm, list, [&](auto value) { return PrimitiveString::create(vm, value); });
}
}