summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-20 12:47:19 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-20 15:45:07 +0200
commit4aa98052caa728da0de4c3960d312d8cf92f1be7 (patch)
tree16e3ca17932649a84203bf2a18f911ec439dd257
parented0740d73c40dfdf6f1422629f37a0e9930d80c1 (diff)
downloadserenity-4aa98052caa728da0de4c3960d312d8cf92f1be7.zip
LibJS: Remove some more use of Interpreter::global_object()
Let's do some more work towards supporting multiple global objects.
-rw-r--r--Libraries/LibJS/AST.cpp10
-rw-r--r--Libraries/LibJS/Runtime/ArrayConstructor.cpp6
2 files changed, 8 insertions, 8 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 8a7d05eedb..83d1bac957 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -103,7 +103,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
auto callee = this_value->get(member_expression.computed_property_name(interpreter, global_object)).value_or(js_undefined());
return { this_value, callee };
}
- return { &interpreter.global_object(), m_callee->execute(interpreter, global_object) };
+ return { &global_object, m_callee->execute(interpreter, global_object) };
}
Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
@@ -171,7 +171,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
Object* new_object = nullptr;
Value result;
if (is_new_expression()) {
- new_object = Object::create_empty(interpreter, interpreter.global_object());
+ new_object = Object::create_empty(interpreter, global_object);
auto prototype = function.get("prototype");
if (interpreter.exception())
return {};
@@ -586,7 +586,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
// FIXME: Support deleting locals
ASSERT(!reference.is_local_variable());
if (reference.is_global_variable())
- return interpreter.global_object().delete_property(reference.name());
+ return global_object.delete_property(reference.name());
auto* base_object = reference.base().to_object(interpreter);
if (!base_object)
return {};
@@ -1492,7 +1492,7 @@ void ArrayExpression::dump(int indent) const
Value ArrayExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
{
- auto* array = Array::create(interpreter.global_object());
+ auto* array = Array::create(global_object);
for (auto& element : m_elements) {
auto value = Value();
if (element) {
@@ -1578,7 +1578,7 @@ Value TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject& glo
}
auto& tag_function = tag.as_function();
auto& expressions = m_template_literal->expressions();
- auto* strings = Array::create(interpreter.global_object());
+ auto* strings = Array::create(global_object);
MarkedValueList arguments(interpreter.heap());
arguments.append(strings);
for (size_t i = 0; i < expressions.size(); ++i) {
diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Libraries/LibJS/Runtime/ArrayConstructor.cpp
index 23b155ea81..1a250dce50 100644
--- a/Libraries/LibJS/Runtime/ArrayConstructor.cpp
+++ b/Libraries/LibJS/Runtime/ArrayConstructor.cpp
@@ -54,7 +54,7 @@ ArrayConstructor::~ArrayConstructor()
Value ArrayConstructor::call(Interpreter& interpreter)
{
if (interpreter.argument_count() <= 0)
- return Array::create(interpreter.global_object());
+ return Array::create(global_object());
if (interpreter.argument_count() == 1 && interpreter.argument(0).is_number()) {
auto array_length_value = interpreter.argument(0);
@@ -62,12 +62,12 @@ Value ArrayConstructor::call(Interpreter& interpreter)
interpreter.throw_exception<TypeError>(ErrorType::ArrayInvalidLength);
return {};
}
- auto* array = Array::create(interpreter.global_object());
+ auto* array = Array::create(global_object());
array->indexed_properties().set_array_like_size(array_length_value.as_i32());
return array;
}
- auto* array = Array::create(interpreter.global_object());
+ auto* array = Array::create(global_object());
for (size_t i = 0; i < interpreter.argument_count(); ++i)
array->indexed_properties().append(interpreter.argument(i));
return array;