diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-01 11:06:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-01 16:54:01 +0200 |
commit | 79b829637e0de72fccfb4b98b844d40326f85c72 (patch) | |
tree | 2d65710f12b5ac8edb161e5f1a0cee9c80d21afe /Libraries/LibJS/Runtime/Object.h | |
parent | 1ba2e6768dbaeec0208e84dd0d2606c96baf932b (diff) | |
download | serenity-79b829637e0de72fccfb4b98b844d40326f85c72.zip |
LibJS: Implement most of the Reflect object
Diffstat (limited to 'Libraries/LibJS/Runtime/Object.h')
-rw-r--r-- | Libraries/LibJS/Runtime/Object.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h index c8f36eb3c2..df7c712dc8 100644 --- a/Libraries/LibJS/Runtime/Object.h +++ b/Libraries/LibJS/Runtime/Object.h @@ -46,6 +46,17 @@ public: explicit Object(Object* prototype); virtual ~Object(); + enum class GetOwnPropertyMode { + Key, + Value, + KeyAndValue, + }; + + enum class PutOwnPropertyMode { + Put, + DefineProperty, + }; + Shape& shape() { return *m_shape; } const Shape& shape() const { return *m_shape; } @@ -60,20 +71,11 @@ public: bool put(PropertyName, Value, u8 attributes = default_attributes); Value get_own_property(const Object& this_object, const FlyString& property_name) const; + Value get_own_properties(const Object& this_object, GetOwnPropertyMode, u8 attributes = Attribute::Configurable | Attribute::Enumerable | Attribute::Writable) const; + Value get_own_property_descriptor(const FlyString& property_name) const; - enum class GetOwnPropertyMode { - Key, - Value, - KeyAndValue, - }; - Value get_enumerable_own_properties(const Object& this_object, GetOwnPropertyMode) const; - - enum class PutOwnPropertyMode { - Put, - DefineProperty, - }; - - bool put_own_property(Object& this_object, const FlyString& property_name, u8 attributes, Value, PutOwnPropertyMode); + bool define_property(const FlyString& property_name, const Object& descriptor, bool throw_exceptions = true); + bool put_own_property(Object& this_object, const FlyString& property_name, u8 attributes, Value, PutOwnPropertyMode, bool throw_exceptions = true); bool put_native_function(const FlyString& property_name, AK::Function<Value(Interpreter&)>, i32 length = 0, u8 attribute = default_attributes); bool put_native_property(const FlyString& property_name, AK::Function<Value(Interpreter&)> getter, AK::Function<void(Interpreter&, Value)> setter, u8 attribute = default_attributes); |