From dc0a25f1cdd0fe8a8de3a8a9a8376fc77e8de213 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 9 Feb 2018 17:45:45 +0100 Subject: [PATCH] Minor changes. --- libdevcore/StringUtils.cpp | 11 +++++++---- libsolidity/analysis/DeclarationContainer.h | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libdevcore/StringUtils.cpp b/libdevcore/StringUtils.cpp index 1dbe151f1..3bdf71f5c 100644 --- a/libdevcore/StringUtils.cpp +++ b/libdevcore/StringUtils.cpp @@ -34,17 +34,19 @@ bool dev::stringWithinDistance(string const& _str1, string const& _str2, size_t if (_str1 == _str2) return true; - size_t n1 = _str1.size(), n2 = _str2.size(); + size_t n1 = _str1.size(); + size_t n2 = _str2.size(); size_t distance = stringDistance(_str1, _str2); // if distance is not greater than _maxDistance, and distance is strictly less than length of both names, they can be considered similar // this is to avoid irrelevant suggestions - return distance <= _maxDistance && distance < n1 && distance < n2; + return distance <= _maxDistance && distance < n1 && distance < n2; } size_t dev::stringDistance(string const& _str1, string const& _str2) { - size_t n1 = _str1.size(), n2 = _str2.size(); + size_t n1 = _str1.size(); + size_t n2 = _str2.size(); // Optimize by storing only last 2 rows and current row. So first index is considered modulo 3 vector> dp(3, vector(n2 + 1)); @@ -73,7 +75,8 @@ size_t dev::stringDistance(string const& _str1, string const& _str2) return dp[n1 % 3][n2]; } -string dev::quotedAlternativesList(vector const& suggestions) { +string dev::quotedAlternativesList(vector const& suggestions) +{ if (suggestions.empty()) return ""; if (suggestions.size() == 1) diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h index 94bbe1294..f9b1bda4b 100644 --- a/libsolidity/analysis/DeclarationContainer.h +++ b/libsolidity/analysis/DeclarationContainer.h @@ -59,15 +59,14 @@ public: Declaration const* conflictingDeclaration(Declaration const& _declaration, ASTString const* _name = nullptr) const; /// @returns existing declaration names similar to @a _name. + /// Searches this and all parent containers. std::vector similarNames(ASTString const& _name) const; - private: ASTNode const* m_enclosingNode; DeclarationContainer const* m_enclosingContainer; std::map> m_declarations; std::map> m_invisibleDeclarations; - }; }