1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +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:
Linus Groh 2021-10-02 23:52:27 +01:00
parent 9b6c09e2c4
commit b7e5f08e56
61 changed files with 326 additions and 686 deletions

View file

@ -40,16 +40,12 @@ BoundFunction* FunctionObject::bind(Value bound_this_value, Vector<Value> argume
}();
i32 computed_length = 0;
auto length_property = get(vm.names.length);
if (vm.exception())
return nullptr;
auto length_property = TRY_OR_DISCARD(get(vm.names.length));
if (length_property.is_number())
computed_length = max(0, length_property.as_i32() - static_cast<i32>(arguments.size()));
Object* constructor_prototype = nullptr;
auto prototype_property = target_function.get(vm.names.prototype);
if (vm.exception())
return nullptr;
auto prototype_property = TRY_OR_DISCARD(target_function.get(vm.names.prototype));
if (prototype_property.is_object())
constructor_prototype = &prototype_property.as_object();