mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibJS: Make native function/property callbacks take VM, not Interpreter
More work on decoupling the general runtime from Interpreter. The goal is becoming clearer. Interpreter should be one possible way to execute code inside a VM. In the future we might have other ways :^)
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace JS {
|
||||
|
||||
NativeProperty::NativeProperty(AK::Function<Value(Interpreter&, GlobalObject&)> getter, AK::Function<void(Interpreter&, GlobalObject&, Value)> setter)
|
||||
NativeProperty::NativeProperty(AK::Function<Value(VM&, GlobalObject&)> getter, AK::Function<void(VM&, GlobalObject&, Value)> setter)
|
||||
: m_getter(move(getter))
|
||||
, m_setter(move(setter))
|
||||
{
|
||||
@@ -39,18 +39,18 @@ NativeProperty::~NativeProperty()
|
||||
{
|
||||
}
|
||||
|
||||
Value NativeProperty::get(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
Value NativeProperty::get(VM& vm, GlobalObject& global_object) const
|
||||
{
|
||||
if (!m_getter)
|
||||
return js_undefined();
|
||||
return m_getter(interpreter, global_object);
|
||||
return m_getter(vm, global_object);
|
||||
}
|
||||
|
||||
void NativeProperty::set(Interpreter& interpreter, GlobalObject& global_object, Value value)
|
||||
void NativeProperty::set(VM& vm, GlobalObject& global_object, Value value)
|
||||
{
|
||||
if (!m_setter)
|
||||
return;
|
||||
m_setter(interpreter, global_object, move(value));
|
||||
m_setter(vm, global_object, move(value));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user