mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Omit needless words: don't map a base name or property name down to a keyword.
Swift SVN r31657
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user