[Concurrency] Move removal of leading "get" for async imports.

Name adjustments should be performed by omitNeedlessWords(), not the
early classifcation of async imports.
This commit is contained in:
Doug Gregor
2020-10-21 21:48:52 -07:00
parent e1852956a0
commit 24ea8becc8
6 changed files with 32 additions and 31 deletions

View File

@@ -1220,6 +1220,7 @@ bool swift::omitNeedlessWords(StringRef &baseName,
bool returnsSelf,
bool isProperty,
const InheritedNameSet *allPropertyNames,
bool isAsync,
StringScratchSpace &scratch) {
bool anyChanges = false;
OmissionTypeName resultType = returnsSelf ? contextType : givenResultType;
@@ -1287,6 +1288,14 @@ bool swift::omitNeedlessWords(StringRef &baseName,
}
}
// If the base name of a method imported as "async" starts with the word
// "get", drop the "get".
if (isAsync && camel_case::getFirstWord(baseName) == "get" &&
baseName.size() > 3) {
baseName = baseName.substr(3);
anyChanges = true;
}
// If needed, split the base name.
if (!argNames.empty() &&
splitBaseName(baseName, argNames[0], paramTypes[0], firstParamName))