1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58: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:
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

@ -78,11 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
if (vm.exception())
return {};
auto raw_value = cooked->get(vm.names.raw);
if (vm.exception())
return {};
auto* raw = raw_value.to_object(global_object);
auto* raw = TRY_OR_DISCARD(cooked->get(vm.names.raw)).to_object(global_object);
if (vm.exception())
return {};
@ -98,10 +94,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
StringBuilder builder;
for (size_t i = 0; i < literal_segments; ++i) {
auto next_key = String::number(i);
auto next_segment_value = raw->get(next_key);
if (vm.exception())
return {};
auto next_segment = next_segment_value.to_string(global_object);
auto next_segment = TRY_OR_DISCARD(raw->get(next_key)).to_string(global_object);
if (vm.exception())
return {};