summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Array.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-20 16:25:12 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-20 17:50:48 +0200
commitcd14ebb11f9875b3b1768727a558c8ddbe26eba4 (patch)
treefb918ff2a0597c0c7bb1f73425843508a4ef1648 /Libraries/LibJS/Runtime/Array.cpp
parenta9e4babdaf7401ca83ddaea48eb9671d7b3d5e86 (diff)
downloadserenity-cd14ebb11f9875b3b1768727a558c8ddbe26eba4.zip
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.
Diffstat (limited to 'Libraries/LibJS/Runtime/Array.cpp')
-rw-r--r--Libraries/LibJS/Runtime/Array.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Libraries/LibJS/Runtime/Array.cpp b/Libraries/LibJS/Runtime/Array.cpp
index 950334b721..7efe39e23d 100644
--- a/Libraries/LibJS/Runtime/Array.cpp
+++ b/Libraries/LibJS/Runtime/Array.cpp
@@ -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);