summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Array.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-21 14:37:34 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-21 14:37:34 +0100
commit324b92fd061b4f837c04bb7dee6bf8e1d530e190 (patch)
treeaf82a76db003f91a63fb1fae8f1f95c9328e6c12 /Libraries/LibJS/Runtime/Array.h
parent2a7dbac0c5038456ea21d6fbe0888ec022fb73da (diff)
downloadserenity-324b92fd061b4f837c04bb7dee6bf8e1d530e190.zip
LibJS: Virtualize access to an Object's own properties
Object now has virtual get_own_property() and put_own_property() member functions that can be overridden to provide custom behavior. We use these virtuals to move Array-specific access behavior to Array.
Diffstat (limited to 'Libraries/LibJS/Runtime/Array.h')
-rw-r--r--Libraries/LibJS/Runtime/Array.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/Array.h b/Libraries/LibJS/Runtime/Array.h
index d99873544f..828b70c33f 100644
--- a/Libraries/LibJS/Runtime/Array.h
+++ b/Libraries/LibJS/Runtime/Array.h
@@ -45,6 +45,8 @@ private:
virtual const char* class_name() const override { return "Array"; }
virtual void visit_children(Cell::Visitor&) override;
virtual bool is_array() const override { return true; }
+ virtual Optional<Value> get_own_property(const String& property_name) const override;
+ virtual bool put_own_property(const String& property_name, Value) override;
Vector<Value> m_elements;
};