mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
LibJS: Convert Object::get() to ThrowCompletionOr
To no one's surprise, this patch is pretty big - this is possibly the most used AO of all of them. Definitely worth it though.
This commit is contained in:
parent
9b6c09e2c4
commit
b7e5f08e56
61 changed files with 326 additions and 686 deletions
|
@ -256,9 +256,7 @@ ThrowCompletionOr<bool> Value::is_regexp(GlobalObject& global_object) const
|
|||
return false;
|
||||
|
||||
auto& vm = global_object.vm();
|
||||
auto matcher = as_object().get(*vm.well_known_symbol_match());
|
||||
if (vm.exception())
|
||||
return false;
|
||||
auto matcher = TRY(as_object().get(*vm.well_known_symbol_match()));
|
||||
if (!matcher.is_undefined())
|
||||
return matcher.to_boolean();
|
||||
|
||||
|
@ -1325,10 +1323,7 @@ Value ordinary_has_instance(GlobalObject& global_object, Value lhs, Value rhs)
|
|||
return Value(false);
|
||||
|
||||
Object* lhs_object = &lhs.as_object();
|
||||
auto rhs_prototype = rhs_function.get(vm.names.prototype);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
auto rhs_prototype = TRY_OR_DISCARD(rhs_function.get(vm.names.prototype));
|
||||
if (!rhs_prototype.is_object()) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::InstanceOfOperatorBadPrototype, rhs.to_string_without_side_effects());
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue