mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Omit needless words] After "by", recognize gerunds more liberally.
This commit is contained in:
@@ -508,7 +508,7 @@ static StringRef omitNeedlessWordsFromPrefix(StringRef name,
|
||||
if (firstWord == "By") {
|
||||
StringRef nextWord = camel_case::getFirstWord(
|
||||
newName.substr(firstWord.size()));
|
||||
if (getPartOfSpeech(nextWord) == PartOfSpeech::Gerund) {
|
||||
if (nextWord.endswith("ing")) {
|
||||
return toLowercaseWord(newName.substr(firstWord.size()), scratch);
|
||||
}
|
||||
}
|
||||
@@ -913,6 +913,11 @@ static bool priorWordExtendsPreposition(StringRef preceding,
|
||||
camel_case::sameWordIgnoreFirstCase(preposition, "matching"))
|
||||
return true;
|
||||
|
||||
// according to
|
||||
if (camel_case::sameWordIgnoreFirstCase(preceding, "according") &&
|
||||
camel_case::sameWordIgnoreFirstCase(preposition, "to"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user