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

LibJS: Replace GlobalObject with VM in remaining AOs [Part 19/19]

This commit is contained in:
Linus Groh 2022-08-21 20:38:35 +01:00
parent 25849f8a6d
commit 56b2ae5ac0
46 changed files with 173 additions and 207 deletions

View file

@ -87,12 +87,12 @@ Utf16View PrimitiveString::utf16_string_view() const
return utf16_string().view();
}
Optional<Value> PrimitiveString::get(GlobalObject& global_object, PropertyKey const& property_key) const
Optional<Value> PrimitiveString::get(VM& vm, PropertyKey const& property_key) const
{
if (property_key.is_symbol())
return {};
if (property_key.is_string()) {
if (property_key.as_string() == global_object.vm().names.length.as_string()) {
if (property_key.as_string() == vm.names.length.as_string()) {
auto length = utf16_string().length_in_code_units();
return Value(static_cast<double>(length));
}
@ -104,7 +104,7 @@ Optional<Value> PrimitiveString::get(GlobalObject& global_object, PropertyKey co
auto length = str.length_in_code_units();
if (length <= index.as_index())
return {};
return js_string(vm(), str.substring_view(index.as_index(), 1));
return js_string(vm, str.substring_view(index.as_index(), 1));
}
PrimitiveString* js_string(Heap& heap, Utf16View const& view)