summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-10-02 23:52:27 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-03 20:14:03 +0100
commitb7e5f08e561696001d9b0ced8f3fe50caf186d2c (patch)
treedebbec2ad0557cc166acc7f5777b023b44db080e /Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
parent9b6c09e2c4ff79714dfecb4a98222bec9cc72b71 (diff)
downloadserenity-b7e5f08e561696001d9b0ced8f3fe50caf186d2c.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index e95333b82c..bc12fc8277 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -164,16 +164,18 @@ Result<size_t, JS::Value> WebAssemblyObject::instantiate_module(Wasm::Module con
dbgln("Trying to resolve stuff because import object was specified");
for (const Wasm::Linker::Name& import_name : linker.unresolved_imports()) {
dbgln("Trying to resolve {}::{}", import_name.module, import_name.name);
- auto value = import_object->get(import_name.module);
- if (vm.exception())
+ auto value_or_error = import_object->get(import_name.module);
+ if (value_or_error.is_error())
break;
+ auto value = value_or_error.release_value();
auto object = value.to_object(global_object);
if (vm.exception())
break;
- auto import_ = object->get(import_name.name);
- if (vm.exception())
+ auto import_or_error = object->get(import_name.name);
+ if (import_or_error.is_error())
break;
+ auto import_ = import_or_error.release_value();
import_name.type.visit(
[&](Wasm::TypeIndex index) {
dbgln("Trying to resolve a function {}::{}, type index {}", import_name.module, import_name.name, index.value());