summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 15b9cd5cb..1271ff603 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -826,7 +826,12 @@ void SExpressionWasmBuilder::preParseHeapTypes(Element& module) {
auto parseStructDef = [&](Element& elem, size_t typeIndex) {
FieldList fields;
for (Index i = 1; i < elem.size(); i++) {
- fields.emplace_back(parseField(elem[i], fieldNames[typeIndex][i - 1]));
+ Name name;
+ fields.emplace_back(parseField(elem[i], name));
+ if (name.is()) {
+ // Only add the name to the map if it exists.
+ fieldNames[typeIndex][i - 1] = name;
+ }
}
return Struct(fields);
};