mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Restructure code for alternative identifier suggestions
This commit is contained in:
committed by
Alex Beregszaszi
parent
d123e777d3
commit
8a491c77ba
@@ -25,6 +25,7 @@
|
||||
#include <libsolidity/ast/AST.h>
|
||||
#include <libsolidity/analysis/TypeChecker.h>
|
||||
#include <libsolidity/interface/ErrorReporter.h>
|
||||
#include <libdevcore/StringUtils.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -427,19 +428,7 @@ vector<_T const*> NameAndTypeResolver::cThreeMerge(list<list<_T const*>>& _toMer
|
||||
|
||||
string NameAndTypeResolver::similarNameSuggestions(ASTString const& _name) const
|
||||
{
|
||||
vector<ASTString> suggestions = m_currentScope->similarNames(_name);
|
||||
if (suggestions.empty())
|
||||
return "";
|
||||
if (suggestions.size() == 1)
|
||||
return "\"" + suggestions.front() + "\"";
|
||||
|
||||
string choices = "\"" + suggestions.front() + "\"";
|
||||
for (size_t i = 1; i + 1 < suggestions.size(); ++i)
|
||||
choices += ", \"" + suggestions[i] + "\"";
|
||||
|
||||
choices += " or \"" + suggestions.back() + "\"";
|
||||
|
||||
return choices;
|
||||
return quotedAlternativesList(m_currentScope->similarNames(_name));
|
||||
}
|
||||
|
||||
DeclarationRegistrationHelper::DeclarationRegistrationHelper(
|
||||
|
||||
Reference in New Issue
Block a user