1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibJS: Don't require Interpreter& for constructing an Accessor

This commit is contained in:
Andreas Kling 2020-09-27 19:59:33 +02:00
parent c59a8d84d3
commit a61ede51e2
3 changed files with 8 additions and 8 deletions

View file

@ -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