mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
LibJS: More Interpreter::global_object() removal
Also let's settle on calling the operation of fetching the "this" value from the Interpreter and converting it to a specific Object pointer typed_this() since consistency is nice.
This commit is contained in:
parent
a9e4babdaf
commit
cd14ebb11f
7 changed files with 55 additions and 55 deletions
|
@ -49,7 +49,7 @@ Array::~Array()
|
|||
{
|
||||
}
|
||||
|
||||
Array* array_from(Interpreter& interpreter, GlobalObject& global_object)
|
||||
Array* Array::typed_this(Interpreter& interpreter, GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = interpreter.this_value(global_object).to_object(interpreter);
|
||||
if (!this_object)
|
||||
|
@ -63,7 +63,7 @@ Array* array_from(Interpreter& interpreter, GlobalObject& global_object)
|
|||
|
||||
JS_DEFINE_NATIVE_GETTER(Array::length_getter)
|
||||
{
|
||||
auto* array = array_from(interpreter, interpreter.global_object());
|
||||
auto* array = typed_this(interpreter, global_object);
|
||||
if (!array)
|
||||
return {};
|
||||
return Value(static_cast<i32>(array->indexed_properties().array_like_size()));
|
||||
|
@ -71,7 +71,7 @@ JS_DEFINE_NATIVE_GETTER(Array::length_getter)
|
|||
|
||||
JS_DEFINE_NATIVE_SETTER(Array::length_setter)
|
||||
{
|
||||
auto* array = array_from(interpreter, global_object);
|
||||
auto* array = typed_this(interpreter, global_object);
|
||||
if (!array)
|
||||
return;
|
||||
auto length = value.to_number(interpreter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue