From 3b241843a77ed29d10355fc17383da18d979bc5b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 9 May 2018 01:45:50 +0200 Subject: Use NameDispenser in Disambiguator --- libjulia/optimiser/Disambiguator.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'libjulia/optimiser/Disambiguator.cpp') diff --git a/libjulia/optimiser/Disambiguator.cpp b/libjulia/optimiser/Disambiguator.cpp index df2984e5..b988dba7 100644 --- a/libjulia/optimiser/Disambiguator.cpp +++ b/libjulia/optimiser/Disambiguator.cpp @@ -38,17 +38,7 @@ string Disambiguator::translateIdentifier(string const& _originalName) Scope::Identifier const* id = m_scopes.back()->lookup(_originalName); solAssert(id, ""); 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); } -- cgit v1.2.3