mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Omit needless words: only omit words when they are preceded by a verb or preposition.
The presence of a verb or preposition prior to the redundant part provides a firm linguistic split that lets the actual argument fill in for the reader. For other parts of speech (adjectives, especially) it's awkward to transition from "reading part of the name" to "reading the argument". This eliminates a significant number of bad omissions, e.g., "setTextColor()" -> "setText()", and generally makes the transformation more conservative. Swift SVN r31656
This commit is contained in:
@@ -36,6 +36,16 @@ namespace swift {
|
||||
/// ignoring case.
|
||||
PrepositionKind getPrepositionKind(StringRef word);
|
||||
|
||||
/// Describes the part of speech of a particular word.
|
||||
enum class PartOfSpeech {
|
||||
Unknown,
|
||||
Preposition,
|
||||
Verb
|
||||
};
|
||||
|
||||
/// Determine the part of speech for the given word.
|
||||
PartOfSpeech getPartOfSpeech(StringRef word);
|
||||
|
||||
namespace camel_case {
|
||||
class WordIterator;
|
||||
|
||||
@@ -252,7 +262,7 @@ enum class NameRole {
|
||||
FirstParameter,
|
||||
|
||||
// Subsequent parameters in a function or method.
|
||||
SubsequentParameter,
|
||||
SubsequentParameter,
|
||||
|
||||
// The name of a property.
|
||||
Property,
|
||||
|
||||
Reference in New Issue
Block a user