mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4094 from ethereum/disambiguator-cleanup
Use NameDispenser in Disambiguator
This commit is contained in:
commit
58c63dcc9c
@ -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);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <libjulia/ASTDataForward.h>
|
||||
|
||||
#include <libjulia/optimiser/ASTCopier.h>
|
||||
#include <libjulia/optimiser/NameDispenser.h>
|
||||
|
||||
#include <libsolidity/inlineasm/AsmAnalysisInfo.h>
|
||||
|
||||
@ -60,7 +61,7 @@ protected:
|
||||
|
||||
std::vector<solidity::assembly::Scope*> m_scopes;
|
||||
std::map<void const*, std::string> m_translations;
|
||||
std::set<std::string> m_usedNames;
|
||||
NameDispenser m_nameDispenser;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user