mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS: Switch is_array to ThrowCompletionOr
This commit is contained in:
parent
0b9e633482
commit
1db7e096e2
6 changed files with 15 additions and 26 deletions
|
@ -192,8 +192,10 @@ static String double_to_string(double d)
|
|||
}
|
||||
|
||||
// 7.2.2 IsArray ( argument ), https://tc39.es/ecma262/#sec-isarray
|
||||
bool Value::is_array(GlobalObject& global_object) const
|
||||
ThrowCompletionOr<bool> Value::is_array(GlobalObject& global_object) const
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
if (!is_object())
|
||||
return false;
|
||||
auto& object = as_object();
|
||||
|
@ -201,11 +203,8 @@ bool Value::is_array(GlobalObject& global_object) const
|
|||
return true;
|
||||
if (is<ProxyObject>(object)) {
|
||||
auto& proxy = static_cast<ProxyObject const&>(object);
|
||||
if (proxy.is_revoked()) {
|
||||
auto& vm = global_object.vm();
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::ProxyRevoked);
|
||||
return false;
|
||||
}
|
||||
if (proxy.is_revoked())
|
||||
return vm.throw_completion<TypeError>(global_object, ErrorType::ProxyRevoked);
|
||||
return Value(&proxy.target()).is_array(global_object);
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue