Omit needless words: don't map a base name or property name down to a keyword.

Swift SVN r31657
This commit is contained in:
Doug Gregor
2015-09-03 05:04:15 +00:00
parent 8ce50fbd76
commit 8c9eb1cfba
3 changed files with 20 additions and 0 deletions

View File

@@ -380,6 +380,20 @@ StringRef swift::omitNeedlessWords(StringRef name, StringRef typeName,
if (newName == "get" || newName == "set")
return name;
// If we ended up with a keyword for a property name or base name,
// do nothing.
switch (role) {
case NameRole::BaseName:
case NameRole::Property:
if (isKeyword(newName))
return name;
break;
case NameRole::FirstParameter:
case NameRole::SubsequentParameter:
break;
}
// We're done.
return newName;
}