Move string distance function to utils and format error message

This commit is contained in:
Balajiganapathi S
2018-02-13 14:59:33 +00:00
committed by Alex Beregszaszi
parent 2859834e58
commit b1417b318f
6 changed files with 122 additions and 52 deletions
+4 -4
View File
@@ -431,13 +431,13 @@ string NameAndTypeResolver::similarNameSuggestions(ASTString const& _name) const
if (suggestions.empty())
return "";
if (suggestions.size() == 1)
return suggestions.front();
return "\"" + suggestions.front() + "\"";
string choices = suggestions.front();
string choices = "\"" + suggestions.front() + "\"";
for (size_t i = 1; i + 1 < suggestions.size(); ++i)
choices += ", " + suggestions[i];
choices += ", \"" + suggestions[i] + "\"";
choices += " or " + suggestions.back();
choices += " or \"" + suggestions.back() + "\"";
return choices;
}