mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
LibJS: ArrayBuffer.prototype.slice
Implements the aforementioned native Javascript function, following the specification's [1] implementation. [1] https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
This commit is contained in:
parent
b50de19cd3
commit
01187e58f2
4 changed files with 82 additions and 1 deletions
|
@ -34,12 +34,23 @@ ArrayBuffer* ArrayBuffer::create(GlobalObject& global_object, size_t byte_size)
|
|||
return global_object.heap().allocate<ArrayBuffer>(global_object, byte_size, *global_object.array_buffer_prototype());
|
||||
}
|
||||
|
||||
ArrayBuffer* ArrayBuffer::create(GlobalObject& global_object, ByteBuffer& buffer)
|
||||
{
|
||||
return global_object.heap().allocate<ArrayBuffer>(global_object, buffer, *global_object.array_buffer_prototype());
|
||||
}
|
||||
|
||||
ArrayBuffer::ArrayBuffer(size_t byte_size, Object& prototype)
|
||||
: Object(prototype)
|
||||
, m_buffer(ByteBuffer::create_zeroed(byte_size))
|
||||
{
|
||||
}
|
||||
|
||||
ArrayBuffer::ArrayBuffer(ByteBuffer& buffer, Object& prototype)
|
||||
: Object(prototype)
|
||||
, m_buffer(buffer)
|
||||
{
|
||||
}
|
||||
|
||||
ArrayBuffer::~ArrayBuffer()
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue