diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 17:12:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 17:12:53 -0800 |
commit | 2d62cad7e131ffb8b7bde80542f72dd8d278a859 (patch) | |
tree | ca6cce62f1227415e3065c5d04960d361fec6e4f | |
parent | 9c14e35d31a91558e2a4efe02d11406665f1f6f0 (diff) | |
download | binaryen-2d62cad7e131ffb8b7bde80542f72dd8d278a859.tar.gz binaryen-2d62cad7e131ffb8b7bde80542f72dd8d278a859.tar.bz2 binaryen-2d62cad7e131ffb8b7bde80542f72dd8d278a859.zip |
Name::fromInt
-rw-r--r-- | src/wasm.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wasm.h b/src/wasm.h index a90fef297..59d51b07c 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -38,6 +38,10 @@ struct Name : public cashew::IString { assert(name.str); return o << '$' << name.str; // reference interpreter requires we prefix all names } + + static Name fromInt(size_t i) { + return cashew::IString(std::to_string(i).c_str(), false); + } }; // Types @@ -863,7 +867,7 @@ public: Module() : functionTypeIndex(0), importIndex(0), exportIndex(0), functionIndex(0) {} void addFunctionType(FunctionType* curr) { - Name numericName = getNumericName(functionTypeIndex); + Name numericName = Name::fromInt(functionTypeIndex); if (!curr->name) { curr->name = numericName; } @@ -873,7 +877,7 @@ public: functionTypeIndex++; } void addImport(Import* curr) { - Name numericName = getNumericName(importIndex); + Name numericName = Name::fromInt(importIndex); if (!curr->name) { curr->name = numericName; } @@ -883,7 +887,7 @@ public: importIndex++; } void addExport(Export* curr) { - Name numericName = getNumericName(exportIndex); + Name numericName = Name::fromInt(exportIndex); if (!curr->name) { curr->name = numericName; } @@ -893,7 +897,7 @@ public: exportIndex++; } void addFunction(Function* curr) { - Name numericName = getNumericName(functionIndex); + Name numericName = Name::fromInt(functionIndex); if (!curr->name) { curr->name = numericName; } @@ -969,10 +973,6 @@ public: } private: - Name getNumericName(size_t i) { - return cashew::IString(std::to_string(i).c_str(), false); - } - size_t functionTypeIndex, importIndex, exportIndex, functionIndex; }; |