summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index b70f70b4e..746d96cf2 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -387,7 +387,11 @@ private:
bool brokeToAutoBlock;
Name getPrefixedName(std::string prefix) {
- return IString((prefix + std::to_string(otherIndex++)).c_str(), false);
+ // make sure to return a unique name not already on the stack
+ while (1) {
+ Name ret = IString((prefix + std::to_string(otherIndex++)).c_str(), false);
+ if (std::find(labelStack.begin(), labelStack.end(), ret) == labelStack.end()) return ret;
+ }
}
Name getFunctionName(Element& s) {