@@ -873,10 +873,6 @@ static bool shouldPlacePrepositionOnArgLabel(StringRef beforePreposition,
873
873
afterPreposition == " Z" )
874
874
return false ;
875
875
876
- // The preposition "of" binds tightly to the left word.
877
- if (camel_case::sameWordIgnoreFirstCase (preposition, " of" ))
878
- return false ;
879
-
880
876
return true ;
881
877
}
882
878
@@ -1147,9 +1143,12 @@ bool swift::omitNeedlessWords(StringRef &baseName,
1147
1143
}
1148
1144
1149
1145
// If needed, split the base name.
1146
+ bool didSplitBaseName = false ;
1150
1147
if (!argNames.empty () &&
1151
- splitBaseName (baseName, argNames[0 ], paramTypes[0 ], firstParamName))
1148
+ splitBaseName (baseName, argNames[0 ], paramTypes[0 ], firstParamName)) {
1149
+ didSplitBaseName = true ;
1152
1150
anyChanges = true ;
1151
+ }
1153
1152
1154
1153
// Omit needless words based on parameter types.
1155
1154
for (unsigned i = 0 , n = argNames.size (); i != n; ++i) {
@@ -1182,5 +1181,16 @@ bool swift::omitNeedlessWords(StringRef &baseName,
1182
1181
}
1183
1182
}
1184
1183
1184
+ // Place a "lonely of" on the base name, rather than having it as
1185
+ // the first argument label.
1186
+ if (didSplitBaseName &&
1187
+ camel_case::sameWordIgnoreFirstCase (argNames[0 ], " of" )) {
1188
+ SmallString<16 > newBaseName;
1189
+ newBaseName += baseName;
1190
+ newBaseName += " Of" ;
1191
+ baseName = scratch.copyString (newBaseName);
1192
+ argNames[0 ] = StringRef ();
1193
+ }
1194
+
1185
1195
return lowercaseAcronymsForReturn ();
1186
1196
}
0 commit comments