mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 18:57:42 +00:00
LibJS: NativeProperty get/put should take a GlobalObject&
This commit is contained in:
parent
03da70c7d0
commit
e1f9da142e
3 changed files with 8 additions and 8 deletions
|
@ -40,18 +40,18 @@ NativeProperty::~NativeProperty()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Value NativeProperty::get(Interpreter& interpreter) const
|
Value NativeProperty::get(Interpreter& interpreter, GlobalObject& global_object) const
|
||||||
{
|
{
|
||||||
if (!m_getter)
|
if (!m_getter)
|
||||||
return js_undefined();
|
return js_undefined();
|
||||||
return m_getter(interpreter, global_object());
|
return m_getter(interpreter, global_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeProperty::set(Interpreter& interpreter, Value value)
|
void NativeProperty::set(Interpreter& interpreter, GlobalObject& global_object, Value value)
|
||||||
{
|
{
|
||||||
if (!m_setter)
|
if (!m_setter)
|
||||||
return;
|
return;
|
||||||
m_setter(interpreter, global_object(), move(value));
|
m_setter(interpreter, global_object, move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ public:
|
||||||
NativeProperty(AK::Function<Value(Interpreter&, GlobalObject&)> getter, AK::Function<void(Interpreter&, GlobalObject&, Value)> setter);
|
NativeProperty(AK::Function<Value(Interpreter&, GlobalObject&)> getter, AK::Function<void(Interpreter&, GlobalObject&, Value)> setter);
|
||||||
virtual ~NativeProperty() override;
|
virtual ~NativeProperty() override;
|
||||||
|
|
||||||
Value get(Interpreter&) const;
|
Value get(Interpreter&, GlobalObject&) const;
|
||||||
void set(Interpreter&, Value);
|
void set(Interpreter&, GlobalObject&, Value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool is_native_property() const override { return true; }
|
virtual bool is_native_property() const override { return true; }
|
||||||
|
|
|
@ -808,7 +808,7 @@ Value Object::call_native_property_getter(Object* this_object, Value property) c
|
||||||
auto& native_property = static_cast<NativeProperty&>(property.as_object());
|
auto& native_property = static_cast<NativeProperty&>(property.as_object());
|
||||||
auto& call_frame = interpreter().push_call_frame();
|
auto& call_frame = interpreter().push_call_frame();
|
||||||
call_frame.this_value = this_object;
|
call_frame.this_value = this_object;
|
||||||
auto result = native_property.get(interpreter());
|
auto result = native_property.get(interpreter(), global_object());
|
||||||
interpreter().pop_call_frame();
|
interpreter().pop_call_frame();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -820,7 +820,7 @@ void Object::call_native_property_setter(Object* this_object, Value property, Va
|
||||||
auto& native_property = static_cast<NativeProperty&>(property.as_object());
|
auto& native_property = static_cast<NativeProperty&>(property.as_object());
|
||||||
auto& call_frame = interpreter().push_call_frame();
|
auto& call_frame = interpreter().push_call_frame();
|
||||||
call_frame.this_value = this_object;
|
call_frame.this_value = this_object;
|
||||||
native_property.set(interpreter(), value);
|
native_property.set(interpreter(), global_object(), value);
|
||||||
interpreter().pop_call_frame();
|
interpreter().pop_call_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue