diff options
author | Balajiganapathi S <balajiganapathi.s@gmail.com> | 2017-11-22 00:50:35 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-13 23:00:15 +0800 |
commit | 8a491c77ba9680afdf8c33664e905b978152b095 (patch) | |
tree | 04eb2325c2a6e20d6a21ef0d9fe64efc1629d9a6 /libsolidity/analysis/DeclarationContainer.cpp | |
parent | d123e777d33be3134ebbcda969f149e0e7ad0b0f (diff) | |
download | dexon-solidity-8a491c77ba9680afdf8c33664e905b978152b095.tar.gz dexon-solidity-8a491c77ba9680afdf8c33664e905b978152b095.tar.zst dexon-solidity-8a491c77ba9680afdf8c33664e905b978152b095.zip |
Restructure code for alternative identifier suggestions
Diffstat (limited to 'libsolidity/analysis/DeclarationContainer.cpp')
-rw-r--r-- | libsolidity/analysis/DeclarationContainer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.cpp b/libsolidity/analysis/DeclarationContainer.cpp index f9a52dc6..7508ad9e 100644 --- a/libsolidity/analysis/DeclarationContainer.cpp +++ b/libsolidity/analysis/DeclarationContainer.cpp @@ -119,20 +119,19 @@ vector<Declaration const*> DeclarationContainer::resolveName(ASTString const& _n vector<ASTString> DeclarationContainer::similarNames(ASTString const& _name) const { + static size_t const MAXIMUM_EDIT_DISTANCE = 2; + vector<ASTString> similar; for (auto const& declaration: m_declarations) { string const& declarationName = declaration.first; - if (stringWithinDistance(_name, declarationName, MAXIMUM_DISTANCE)) + if (stringWithinDistance(_name, declarationName, MAXIMUM_EDIT_DISTANCE)) similar.push_back(declarationName); } if (m_enclosingContainer) - { - vector<ASTString> enclosingSimilar = m_enclosingContainer->similarNames(_name); - similar.insert(similar.end(), enclosingSimilar.begin(), enclosingSimilar.end()); - } + similar += m_enclosingContainer->similarNames(_name); return similar; } |