diff options
Diffstat (limited to 'libjulia/optimiser/Disambiguator.cpp')
-rw-r--r-- | libjulia/optimiser/Disambiguator.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/libjulia/optimiser/Disambiguator.cpp b/libjulia/optimiser/Disambiguator.cpp index df2984e5..687be9b9 100644 --- a/libjulia/optimiser/Disambiguator.cpp +++ b/libjulia/optimiser/Disambiguator.cpp @@ -20,11 +20,11 @@ #include <libjulia/optimiser/Disambiguator.h> +#include <libjulia/Exceptions.h> + #include <libsolidity/inlineasm/AsmData.h> #include <libsolidity/inlineasm/AsmScope.h> -#include <libsolidity/interface/Exceptions.h> - using namespace std; using namespace dev; using namespace dev::julia; @@ -34,21 +34,11 @@ using Scope = dev::solidity::assembly::Scope; string Disambiguator::translateIdentifier(string const& _originalName) { - solAssert(!m_scopes.empty() && m_scopes.back(), ""); + assertThrow(!m_scopes.empty() && m_scopes.back(), OptimizerException, ""); Scope::Identifier const* id = m_scopes.back()->lookup(_originalName); - solAssert(id, ""); + assertThrow(id, OptimizerException, ""); if (!m_translations.count(id)) - { - string translated = _originalName; - size_t suffix = 0; - while (m_usedNames.count(translated)) - { - suffix++; - translated = _originalName + "_" + std::to_string(suffix); - } - m_usedNames.insert(translated); - m_translations[id] = translated; - } + m_translations[id] = m_nameDispenser.newName(_originalName); return m_translations.at(id); } @@ -79,7 +69,7 @@ void Disambiguator::enterScopeInternal(Scope& _scope) void Disambiguator::leaveScopeInternal(Scope& _scope) { - solAssert(!m_scopes.empty(), ""); - solAssert(m_scopes.back() == &_scope, ""); + assertThrow(!m_scopes.empty(), OptimizerException, ""); + assertThrow(m_scopes.back() == &_scope, OptimizerException, ""); m_scopes.pop_back(); } |