Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2458)

Unified Diff: pkg/analysis_server/lib/src/services/correction/name_suggestion.dart

Issue 1394933003: Move getCamelWords() to the strings.dart file. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/strings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
index c9e4ef6a72d94bfae73ac0e65a65d55b74fa76a2..52344051cc23a7bd4e24000f9031399dceeb33d5 100644
--- a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
+++ b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
@@ -11,46 +11,6 @@ import 'package:analyzer/src/generated/element.dart';
List<String> _KNOWN_METHOD_NAME_PREFIXES = ['get', 'is', 'to'];
/**
- * Returns a list of words for the given camel case string.
- *
- * 'getCamelWords' => ['get', 'Camel', 'Words']
- * 'getHTMLText' => ['get', 'HTML', 'Text']
- */
-List<String> getCamelWords(String str) {
- if (str == null || str.isEmpty) {
- return <String>[];
- }
- List<String> parts = <String>[];
- bool wasLowerCase = false;
- bool wasUpperCase = false;
- int wordStart = 0;
- for (int i = 0; i < str.length; i++) {
- int c = str.codeUnitAt(i);
- var newLowerCase = isLowerCase(c);
- var newUpperCase = isUpperCase(c);
- // myWord
- // | ^
- if (wasLowerCase && newUpperCase) {
- parts.add(str.substring(wordStart, i));
- wordStart = i;
- }
- // myHTMLText
- // | ^
- if (wasUpperCase &&
- newUpperCase &&
- i + 1 < str.length &&
- isLowerCase(str.codeUnitAt(i + 1))) {
- parts.add(str.substring(wordStart, i));
- wordStart = i;
- }
- wasLowerCase = newLowerCase;
- wasUpperCase = newUpperCase;
- }
- parts.add(str.substring(wordStart));
- return parts;
-}
-
-/**
* Returns possible names for a variable with the given expected type and
* expression assigned.
*/
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/strings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698