mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:02:06 +00:00
LibWeb: Convert WebAssemblyObject AOs to ThrowCompletionOr
This commit is contained in:
parent
a76cd669b1
commit
3e8c76d5ab
6 changed files with 62 additions and 102 deletions
|
@ -62,17 +62,14 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyTableConstructor::construct(Functi
|
|||
return vm.throw_completion<JS::RangeError>(global_object, "maximum should be larger than or equal to initial");
|
||||
|
||||
auto value_value = TRY(descriptor->get("value"));
|
||||
auto reference_value = [&]() -> Optional<Wasm::Value> {
|
||||
auto reference_value = TRY([&]() -> JS::ThrowCompletionOr<Wasm::Value> {
|
||||
if (value_value.is_undefined())
|
||||
return Wasm::Value(*reference_type, 0ull);
|
||||
|
||||
return to_webassembly_value(global_object, value_value, *reference_type);
|
||||
}();
|
||||
}());
|
||||
|
||||
if (auto* exception = vm.exception())
|
||||
return JS::throw_completion(exception->value());
|
||||
|
||||
auto& reference = reference_value->value().get<Wasm::Reference>();
|
||||
auto& reference = reference_value.value().get<Wasm::Reference>();
|
||||
|
||||
auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::TableType { *reference_type, Wasm::Limits { initial, maximum } });
|
||||
if (!address.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue