mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:28:11 +00:00
LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr
This commit is contained in:
parent
a90107b02a
commit
ab594e5f2f
35 changed files with 196 additions and 328 deletions
|
@ -190,8 +190,8 @@ Result<size_t, JS::Value> WebAssemblyObject::instantiate_module(Wasm::Module con
|
|||
for (auto& entry : arguments)
|
||||
argument_values.append(to_js_value(entry, global_object));
|
||||
|
||||
auto result = vm.call(function, JS::js_undefined(), move(argument_values));
|
||||
if (vm.exception()) {
|
||||
auto result_or_error = vm.call(function, JS::js_undefined(), move(argument_values));
|
||||
if (result_or_error.is_error()) {
|
||||
vm.clear_exception();
|
||||
return Wasm::Trap();
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ Result<size_t, JS::Value> WebAssemblyObject::instantiate_module(Wasm::Module con
|
|||
return Wasm::Result { Vector<Wasm::Value> {} };
|
||||
|
||||
if (type.results().size() == 1) {
|
||||
auto value = to_webassembly_value(result, type.results().first(), global_object);
|
||||
auto value = to_webassembly_value(result_or_error.release_value(), type.results().first(), global_object);
|
||||
if (!value.has_value())
|
||||
return Wasm::Trap {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue