1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibJS: Make NativeProperty a plain Cell instead of an Object

This removes the need for NativeProperty objects to have a prototype,
which just made things confusing.
This commit is contained in:
Andreas Kling 2020-06-23 17:56:57 +02:00
parent ba641e97d9
commit 0166a1fa74
6 changed files with 33 additions and 25 deletions

View file

@ -31,18 +31,16 @@
namespace JS {
class NativeProperty final : public Object {
JS_OBJECT(NativeProperty, Object);
class NativeProperty final : public Cell {
public:
NativeProperty(GlobalObject&, 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;
Value get(Interpreter&, GlobalObject&) const;
void set(Interpreter&, GlobalObject&, Value);
private:
virtual bool is_native_property() const override { return true; }
virtual const char* class_name() const override { return "NativeProperty"; }
AK::Function<Value(Interpreter&, GlobalObject&)> m_getter;
AK::Function<void(Interpreter&, GlobalObject&, Value)> m_setter;