mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibJS: Convert to_u32() to ThrowCompletionOr
This commit is contained in:
parent
f6a5ff7b00
commit
cc94bba5c0
14 changed files with 32 additions and 69 deletions
|
@ -41,17 +41,12 @@ JS::Value WebAssemblyMemoryConstructor::construct(FunctionObject&)
|
|||
return {};
|
||||
}
|
||||
|
||||
auto initial = initial_value.to_u32(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto initial = TRY_OR_DISCARD(initial_value.to_u32(global_object));
|
||||
|
||||
Optional<u32> maximum;
|
||||
|
||||
if (!maximum_value.is_empty()) {
|
||||
maximum = maximum_value.to_u32(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
}
|
||||
if (!maximum_value.is_empty())
|
||||
maximum = TRY_OR_DISCARD(maximum_value.to_u32(global_object));
|
||||
|
||||
auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::MemoryType { Wasm::Limits { initial, maximum } });
|
||||
if (!address.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue