mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibJS: Make more use of Value::is and Value::as_if
This commit is contained in:
Notes:
github-actions[bot]
2026-02-28 15:26:17 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/502ae991024 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8216 Reviewed-by: https://github.com/trflynn89 ✅
@@ -76,12 +76,11 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm)
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION($262Object::detach_array_buffer)
|
||||
{
|
||||
auto array_buffer = vm.argument(0);
|
||||
if (!array_buffer.is_object() || !is<ArrayBuffer>(array_buffer.as_object()))
|
||||
auto array_buffer = vm.argument(0).as_if<ArrayBuffer>();
|
||||
if (!array_buffer)
|
||||
return vm.throw_completion<TypeError>();
|
||||
|
||||
auto& array_buffer_object = static_cast<ArrayBuffer&>(array_buffer.as_object());
|
||||
TRY(JS::detach_array_buffer(vm, array_buffer_object, vm.argument(1)));
|
||||
TRY(JS::detach_array_buffer(vm, *array_buffer, vm.argument(1)));
|
||||
return js_null();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user