mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +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 ✅
@@ -80,14 +80,14 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayBufferConstructor::is_view)
|
||||
auto arg = vm.argument(0);
|
||||
|
||||
// 1. If arg is not an Object, return false.
|
||||
if (!arg.is_object())
|
||||
auto object = arg.as_if<Object>();
|
||||
if (!object)
|
||||
return false;
|
||||
auto const& object = arg.as_object();
|
||||
|
||||
// 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
|
||||
if (object.is_typed_array())
|
||||
if (object->is_typed_array())
|
||||
return true;
|
||||
if (is<DataView>(object))
|
||||
if (is<DataView>(*object))
|
||||
return true;
|
||||
|
||||
// 3. Return false.
|
||||
|
||||
Reference in New Issue
Block a user