summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 3c8cc86df..151a7f911 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2464,7 +2464,12 @@ void WasmBinaryReader::readTypes() {
if (auto* err = result.getError()) {
Fatal() << "Invalid type: " << err->reason << " at index " << err->index;
}
- types = *result;
+ types = std::move(*result);
+
+ // Record the type indices.
+ for (Index i = 0; i < types.size(); ++i) {
+ wasm.typeIndices.insert({types[i], i});
+ }
}
Name WasmBinaryReader::getFunctionName(Index index) {