summaryrefslogtreecommitdiff
path: root/src/parser/wat-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/wat-parser.cpp')
-rw-r--r--src/parser/wat-parser.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/parser/wat-parser.cpp b/src/parser/wat-parser.cpp
index be3bca5c8..cc0f582fc 100644
--- a/src/parser/wat-parser.cpp
+++ b/src/parser/wat-parser.cpp
@@ -132,6 +132,7 @@ Result<> parseModule(Module& wasm, std::string_view input) {
// Parse implicit type definitions and map typeuses without explicit types to
// the correct types.
std::unordered_map<Index, HeapType> implicitTypes;
+
{
ParseImplicitTypeDefsCtx ctx(input, types, implicitTypes, *typeIndices);
for (Index pos : decls.implicitTypeDefs) {
@@ -142,18 +143,31 @@ Result<> parseModule(Module& wasm, std::string_view input) {
{
// Parse module-level types.
- ParseModuleTypesCtx ctx(input, wasm, types, implicitTypes, *typeIndices);
+ ParseModuleTypesCtx ctx(input,
+ wasm,
+ types,
+ implicitTypes,
+ decls.implicitElemIndices,
+ *typeIndices);
CHECK_ERR(parseDefs(ctx, decls.funcDefs, func));
+ CHECK_ERR(parseDefs(ctx, decls.tableDefs, table));
CHECK_ERR(parseDefs(ctx, decls.memoryDefs, memory));
CHECK_ERR(parseDefs(ctx, decls.globalDefs, global));
+ CHECK_ERR(parseDefs(ctx, decls.elemDefs, elem));
CHECK_ERR(parseDefs(ctx, decls.tagDefs, tag));
- // TODO: Parse types of other module elements.
}
{
// Parse definitions.
// TODO: Parallelize this.
- ParseDefsCtx ctx(input, wasm, types, implicitTypes, *typeIndices);
+ ParseDefsCtx ctx(input,
+ wasm,
+ types,
+ implicitTypes,
+ decls.implicitElemIndices,
+ *typeIndices);
+ CHECK_ERR(parseDefs(ctx, decls.tableDefs, table));
CHECK_ERR(parseDefs(ctx, decls.globalDefs, global));
+ CHECK_ERR(parseDefs(ctx, decls.elemDefs, elem));
CHECK_ERR(parseDefs(ctx, decls.dataDefs, data));
for (Index i = 0; i < decls.funcDefs.size(); ++i) {