diff options
author | chriseth <chris@ethereum.org> | 2018-11-09 07:21:37 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-11-09 22:40:36 +0800 |
commit | 0f2ba3522fb01713a417d7b66c6c586359d6d130 (patch) | |
tree | 1f1ac31a06c05ca2acdb3029b988b2bc7e489121 /libyul/YulString.h | |
parent | 6bbedab383f7c8799ef7bcf4cad2bb008a7fcf2c (diff) | |
download | dexon-solidity-0f2ba3522fb01713a417d7b66c6c586359d6d130.tar.gz dexon-solidity-0f2ba3522fb01713a417d7b66c6c586359d6d130.tar.zst dexon-solidity-0f2ba3522fb01713a417d7b66c6c586359d6d130.zip |
Reset yul string repository.
Diffstat (limited to 'libyul/YulString.h')
-rw-r--r-- | libyul/YulString.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libyul/YulString.h b/libyul/YulString.h index ae01c83f..a8015239 100644 --- a/libyul/YulString.h +++ b/libyul/YulString.h @@ -35,9 +35,9 @@ namespace yul class YulStringRepository: boost::noncopyable { public: - YulStringRepository(): m_strings{std::make_shared<std::string>()} + YulStringRepository() { - m_ids[std::string{}] = 0; + reset(); } static YulStringRepository& instance() { @@ -61,6 +61,14 @@ public: return *m_strings.at(_id); } + void reset() + { + m_strings.clear(); + m_ids.clear(); + m_strings.emplace_back(std::make_shared<std::string>()); + m_ids[std::string{}] = 0; + } + private: std::vector<std::shared_ptr<std::string>> m_strings; std::map<std::string, size_t> m_ids; |