summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-27 19:59:33 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-27 20:26:58 +0200
commita61ede51e214ce8e231b550c47c2ed525afc643b (patch)
tree231b63c9fc09d135f511bde6261b3db1c727905e /Libraries/LibJS
parentc59a8d84d33a2927f5fcc4a637dce4eb8a055154 (diff)
downloadserenity-a61ede51e214ce8e231b550c47c2ed525afc643b.zip
LibJS: Don't require Interpreter& for constructing an Accessor
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r--Libraries/LibJS/Runtime/Accessor.h10
-rw-r--r--Libraries/LibJS/Runtime/IndexedProperties.cpp2
-rw-r--r--Libraries/LibJS/Runtime/Object.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/Libraries/LibJS/Runtime/Accessor.h b/Libraries/LibJS/Runtime/Accessor.h
index d2fa5103e0..00aa2eab1a 100644
--- a/Libraries/LibJS/Runtime/Accessor.h
+++ b/Libraries/LibJS/Runtime/Accessor.h
@@ -27,16 +27,16 @@
#pragma once
-#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Function.h>
+#include <LibJS/Runtime/VM.h>
namespace JS {
class Accessor final : public Cell {
public:
- static Accessor* create(Interpreter& interpreter, Function* getter, Function* setter)
+ static Accessor* create(VM& vm, Function* getter, Function* setter)
{
- return interpreter.heap().allocate_without_global_object<Accessor>(getter, setter);
+ return vm.heap().allocate_without_global_object<Accessor>(getter, setter);
}
Accessor(Function* getter, Function* setter)
@@ -55,7 +55,7 @@ public:
{
if (!m_getter)
return js_undefined();
- return interpreter().call(*m_getter, this_value);
+ return vm().call(*m_getter, this_value);
}
void call_setter(Value this_value, Value setter_value)
@@ -63,7 +63,7 @@ public:
if (!m_setter)
return;
// FIXME: It might be nice if we had a way to communicate to our caller if an exception happened after this.
- (void)interpreter().call(*m_setter, this_value, setter_value);
+ (void)vm().call(*m_setter, this_value, setter_value);
}
void visit_children(Cell::Visitor& visitor) override
diff --git a/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Libraries/LibJS/Runtime/IndexedProperties.cpp
index 5b327e302d..65bbc6a89b 100644
--- a/Libraries/LibJS/Runtime/IndexedProperties.cpp
+++ b/Libraries/LibJS/Runtime/IndexedProperties.cpp
@@ -341,7 +341,7 @@ void IndexedProperties::append_all(Object* this_object, const IndexedProperties&
for (auto it = properties.begin(false); it != properties.end(); ++it) {
const auto& element = it.value_and_attributes(this_object, evaluate_accessors);
- if (this_object && this_object->interpreter().exception())
+ if (this_object && this_object->vm().exception())
return;
m_storage->put(m_storage->array_like_size(), element.value, element.attributes);
}
diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp
index d8656e0cbe..1f30517d9f 100644
--- a/Libraries/LibJS/Runtime/Object.cpp
+++ b/Libraries/LibJS/Runtime/Object.cpp
@@ -392,7 +392,7 @@ bool Object::define_property(const StringOrSymbol& property_name, const Object&
<< "setter=" << setter.to_string_without_side_effects() << "}";
#endif
- return define_property(property_name, Accessor::create(interpreter(), getter_function, setter_function), attributes, throw_exceptions);
+ return define_property(property_name, Accessor::create(vm(), getter_function, setter_function), attributes, throw_exceptions);
}
auto value = descriptor.get("value");
@@ -438,7 +438,7 @@ bool Object::define_accessor(const PropertyName& property_name, Function& getter
accessor = &existing_property.as_accessor();
}
if (!accessor) {
- accessor = Accessor::create(interpreter(), nullptr, nullptr);
+ accessor = Accessor::create(vm(), nullptr, nullptr);
bool definition_success = define_property(property_name, accessor, attributes, throw_exceptions);
if (vm().exception())
return {};