diff options
author | Balajiganapathi S <balajiganapathi.s@gmail.com> | 2017-10-29 16:08:40 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-13 22:54:36 +0800 |
commit | 2859834e58e37e7b15a15f7df60feef3e1527c97 (patch) | |
tree | 65ec5738fb2e1cd029eece2364b63f3fd46d7da1 /libsolidity/analysis/DeclarationContainer.h | |
parent | 8f8ad3840eecd7b22565e0c36eb55ceca5d5b57a (diff) | |
download | dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar.gz dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar.bz2 dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar.lz dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar.xz dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.tar.zst dexon-solidity-2859834e58e37e7b15a15f7df60feef3e1527c97.zip |
Suggest alternatives when identifier not found.
Diffstat (limited to 'libsolidity/analysis/DeclarationContainer.h')
-rw-r--r-- | libsolidity/analysis/DeclarationContainer.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h index 301998b7..991140d8 100644 --- a/libsolidity/analysis/DeclarationContainer.h +++ b/libsolidity/analysis/DeclarationContainer.h @@ -58,11 +58,19 @@ public: /// @returns whether declaration is valid, and if not also returns previous declaration. Declaration const* conflictingDeclaration(Declaration const& _declaration, ASTString const* _name = nullptr) const; + /// @returns existing declaration names similar to @a _name. + std::vector<ASTString> similarNames(ASTString const& _name) const; + + private: ASTNode const* m_enclosingNode; DeclarationContainer const* m_enclosingContainer; std::map<ASTString, std::vector<Declaration const*>> m_declarations; std::map<ASTString, std::vector<Declaration const*>> m_invisibleDeclarations; + + // Calculates the Damerau–Levenshtein distance and decides whether the two names are similar + static bool areSimilarNames(ASTString const& _name1, ASTString const& _name2); + static size_t const MAXIMUM_DISTANCE = 2; }; } |