mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 12:32:20 +02:00
LibJS: Update spec headers of ArrayBuffer, TypedArray, DataView, Atomics
After the resizable ArrayBuffer proposal was merged, a bunch of methods had their spec numbers/headers changed. This patch just updates existing methods to make future patches easier to grok.
This commit is contained in:
committed by
Andreas Kling
parent
d053d6f7bb
commit
4f32392426
Notes:
sideshowbarker
2024-07-17 18:06:52 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/4f32392426 Pull-request: https://github.com/SerenityOS/serenity/pull/22424 Reviewed-by: https://github.com/shannonbooth ✅
@@ -26,19 +26,19 @@ void ArrayBufferConstructor::initialize(Realm& realm)
|
||||
auto& vm = this->vm();
|
||||
Base::initialize(realm);
|
||||
|
||||
// 25.1.4.2 ArrayBuffer.prototype, https://tc39.es/ecma262/#sec-arraybuffer.prototype
|
||||
// 25.1.5.2 ArrayBuffer.prototype, https://tc39.es/ecma262/#sec-arraybuffer.prototype
|
||||
define_direct_property(vm.names.prototype, realm.intrinsics().array_buffer_prototype(), 0);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(realm, vm.names.isView, is_view, 1, attr);
|
||||
|
||||
// 25.1.5.4 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag
|
||||
// 25.1.6.7 ArrayBuffer.prototype [ @@toStringTag ], https://tc39.es/ecma262/#sec-arraybuffer.prototype-@@tostringtag
|
||||
define_native_accessor(realm, vm.well_known_symbol_species(), symbol_species_getter, {}, Attribute::Configurable);
|
||||
|
||||
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
|
||||
}
|
||||
|
||||
// 25.1.3.1 ArrayBuffer ( length ), https://tc39.es/ecma262/#sec-arraybuffer-length
|
||||
// 25.1.4.1 ArrayBuffer ( length [ , options ] ), https://tc39.es/ecma262/#sec-arraybuffer-length
|
||||
ThrowCompletionOr<Value> ArrayBufferConstructor::call()
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
@@ -47,7 +47,7 @@ ThrowCompletionOr<Value> ArrayBufferConstructor::call()
|
||||
return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, vm.names.ArrayBuffer);
|
||||
}
|
||||
|
||||
// 25.1.3.1 ArrayBuffer ( length ), https://tc39.es/ecma262/#sec-arraybuffer-length
|
||||
// 25.1.4.1 ArrayBuffer ( length [ , options ] ), https://tc39.es/ecma262/#sec-arraybuffer-length
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> ArrayBufferConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
@@ -68,7 +68,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> ArrayBufferConstructor::construct(Functi
|
||||
return *TRY(allocate_array_buffer(vm, new_target, byte_length_or_error.release_value()));
|
||||
}
|
||||
|
||||
// 25.1.4.1 ArrayBuffer.isView ( arg ), https://tc39.es/ecma262/#sec-arraybuffer.isview
|
||||
// 25.1.5.1 ArrayBuffer.isView ( arg ), https://tc39.es/ecma262/#sec-arraybuffer.isview
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
||||
{
|
||||
auto arg = vm.argument(0);
|
||||
@@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
||||
return Value(false);
|
||||
}
|
||||
|
||||
// 25.1.4.3 get ArrayBuffer [ @@species ], https://tc39.es/ecma262/#sec-get-arraybuffer-@@species
|
||||
// 25.1.5.3 get ArrayBuffer [ @@species ], https://tc39.es/ecma262/#sec-get-arraybuffer-@@species
|
||||
JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::symbol_species_getter)
|
||||
{
|
||||
// 1. Return the this value.
|
||||
|
||||
Reference in New Issue
Block a user