diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-11 15:09:10 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-11 15:09:10 -0800 |
commit | 83994c9c54f7300701e1736ac0c6d8f2f5adf2c6 (patch) | |
tree | a60f9fca2406fa8a5e3465105b9400e45a74f86f /src | |
parent | 498577be5fbec6c251f71356f4e03f085c58ae34 (diff) | |
download | binaryen-83994c9c54f7300701e1736ac0c6d8f2f5adf2c6.tar.gz binaryen-83994c9c54f7300701e1736ac0c6d8f2f5adf2c6.tar.bz2 binaryen-83994c9c54f7300701e1736ac0c6d8f2f5adf2c6.zip |
use Name::fromInt
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-s-parser.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index fcf0e0dd8..4b05bb91d 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -267,11 +267,7 @@ private: size_t otherIndex; std::vector<Name> labelStack; - IString getName(size_t index) { - return IString(std::to_string(index).c_str(), false); - } - - IString getPrefixedName(std::string prefix) { + Name getPrefixedName(std::string prefix) { return IString((prefix + std::to_string(otherIndex++)).c_str(), false); } @@ -283,7 +279,7 @@ private: i++; } else { // unnamed, use an index - func->name = IString(std::to_string(functionCounter).c_str(), false); + func->name = Name::fromInt(functionCounter); } functionCounter++; func->body = nullptr; @@ -303,7 +299,7 @@ private: } if (type != none) { // a type, so an unnamed parameter - name = getName(localIndex); + name = Name::fromInt(localIndex); } else { name = curr[j]->str(); type = stringToWasmType(curr[j+1]->str()); @@ -327,7 +323,7 @@ private: FunctionType* type = wasm.functionTypesMap[name]; func->result = type->result; for (size_t j = 0; j < type->params.size(); j++) { - IString name = getName(j); + IString name = Name::fromInt(j); WasmType currType = type->params[j]; typeParams.emplace_back(name, currType); currLocalTypes[name] = currType; |