Skip to content

Commit efcf2dc

Browse files
committed
fix
1 parent 8844b1f commit efcf2dc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/wasm/wasm-binary.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,12 +2518,15 @@ getOrMakeName(const std::unordered_map<Index, Name>& nameMap,
25182518
Name name,
25192519
std::unordered_set<Name>& usedNames) {
25202520
if (auto it = nameMap.find(i); it != nameMap.end()) {
2521-
return {it->second, true};
2522-
} else {
2523-
auto valid = Names::getValidNameGivenExisting(name, usedNames);
2524-
usedNames.insert(valid);
2525-
return {valid, false};
2526-
}
2521+
// We found a name in the names section. Use it, and also note it as used
2522+
// so we don't generate such a name below, later.
2523+
auto mappedName = it->second;
2524+
usedNames.insert(mappedName);
2525+
return {mappedName, true};
2526+
}
2527+
auto valid = Names::getValidNameGivenExisting(name, usedNames);
2528+
usedNames.insert(valid);
2529+
return {valid, false};
25272530
}
25282531

25292532
void WasmBinaryReader::readMemories() {

0 commit comments

Comments
 (0)