LibWasm: Clean up module sections API

Remove `for_each_section_of_type` in favor of making the module's
sections defined as distinct fields. This means it is no longer possible
to have two of the same section (which is invalid in WebAssembly, for
anything other than custom sections).
This commit is contained in:
Diego Frias 2024-07-29 19:56:00 -07:00 committed by Ali Mohammad Pur
parent 9f24176cac
commit 23cfee2205
Notes: github-actions[bot] 2024-08-01 10:20:10 +00:00
7 changed files with 469 additions and 541 deletions

View file

@ -182,7 +182,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS
TRY(import_name.type.visit(
[&](Wasm::TypeIndex index) -> JS::ThrowCompletionOr<void> {
dbgln("Trying to resolve a function {}::{}, type index {}", import_name.module, import_name.name, index.value());
auto& type = module.type(index);
auto& type = module.type_section().types()[index.value()];
// FIXME: IsCallable()
if (!import_.is_function())
return {};