diff options
author | davidot <david.tuin@gmail.com> | 2021-06-22 19:40:06 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-22 20:49:28 +0100 |
commit | 105e72cdad74eef950d5b0fd5c5c981e5acc1dc7 (patch) | |
tree | a76a111948d93f589383fe0d4cf6f45da0a5c1f4 /Userland | |
parent | f102b5634556471cace818fa62ed385ec5fd45b4 (diff) | |
download | serenity-105e72cdad74eef950d5b0fd5c5c981e5acc1dc7.zip |
LibJS: Add HasProperty to TypedArray
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/TypedArray.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index 44c943f69b..c84a5cbe69 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -101,6 +101,15 @@ public: return viewed_array_buffer()->template get_value<T>(indexed_position.value(), true, ArrayBuffer::Order::Unordered); } + // 10.4.5.2 [[HasProperty]] ( P ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-hasproperty-p + bool has_property(const PropertyName& name) const override + { + if (name.is_number()) { + return is_valid_integer_index(name.as_number()); + } + return Object::has_property(name); + } + Span<const UnderlyingBufferDataType> data() const { return { reinterpret_cast<const UnderlyingBufferDataType*>(m_viewed_array_buffer->buffer().data() + m_byte_offset), m_array_length }; |