summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-07-30 09:41:13 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-09-07 09:54:50 -0700
commit981c7efa1ae4b27d1efd212284e61b77e89977a5 (patch)
treefd225a3939a981fb223b207955bf7477292e87d9 /src/wasm-s-parser.h
parent96c47400b8bce7b51d161432ff0cc03a9622cf3d (diff)
downloadbinaryen-981c7efa1ae4b27d1efd212284e61b77e89977a5.tar.gz
binaryen-981c7efa1ae4b27d1efd212284e61b77e89977a5.tar.bz2
binaryen-981c7efa1ae4b27d1efd212284e61b77e89977a5.zip
make sure to create unique implicit block names in s-parser
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) {