mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
LibJS+LibWeb: Move native properties to separate getters/setters
This was a bit cumbersome now, but it gets us closer to a format suited for code generation.
This commit is contained in:
parent
56936b97d0
commit
30440134cb
19 changed files with 210 additions and 96 deletions
|
@ -33,18 +33,18 @@ namespace JS {
|
|||
|
||||
class NativeProperty final : public Object {
|
||||
public:
|
||||
NativeProperty(AK::Function<Value(Object*)> getter, AK::Function<void(Object*, Value)> setter);
|
||||
NativeProperty(AK::Function<Value(Interpreter&)> getter, AK::Function<void(Interpreter&, Value)> setter);
|
||||
virtual ~NativeProperty() override;
|
||||
|
||||
Value get(Object*) const;
|
||||
void set(Object*, Value);
|
||||
Value get(Interpreter&) const;
|
||||
void set(Interpreter&, Value);
|
||||
|
||||
private:
|
||||
virtual bool is_native_property() const override { return true; }
|
||||
virtual const char* class_name() const override { return "NativeProperty"; }
|
||||
|
||||
AK::Function<Value(Object*)> m_getter;
|
||||
AK::Function<void(Object*, Value)> m_setter;
|
||||
AK::Function<Value(Interpreter&)> m_getter;
|
||||
AK::Function<void(Interpreter&, Value)> m_setter;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue