| Index: pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
|
| index 35033117be0bc2d99512d7bb82c49ba4deabb26c..aac52754c741badc30a5c0c30db99e3bc55b8b62 100644
|
| --- a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
|
| +++ b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
|
| @@ -6,6 +6,7 @@ library services.src.refactoring.naming_conventions;
|
|
|
| import 'package:analysis_server/src/services/correction/status.dart';
|
| import 'package:analysis_server/src/services/correction/strings.dart';
|
| +import 'package:analyzer/src/generated/scanner.dart';
|
|
|
| /**
|
| * Returns the [RefactoringStatus] with severity:
|
| @@ -164,6 +165,15 @@ RefactoringStatus _validateIdentifier(
|
| String message = "$desc must not be empty.";
|
| return new RefactoringStatus.fatal(message);
|
| }
|
| + // keyword
|
| + {
|
| + Keyword keyword = Keyword.keywords[identifier];
|
| + if (keyword != null && !keyword.isPseudoKeyword) {
|
| + String message = "$desc must not be a keyword.";
|
| + return new RefactoringStatus.fatal(message);
|
| + }
|
| + }
|
| + // first character
|
| int currentChar = identifier.codeUnitAt(0);
|
| if (!isLetter(currentChar) &&
|
| currentChar != CHAR_UNDERSCORE &&
|
| @@ -171,6 +181,7 @@ RefactoringStatus _validateIdentifier(
|
| String message = "$desc must begin with $beginDesc.";
|
| return new RefactoringStatus.fatal(message);
|
| }
|
| + // other characters
|
| for (int i = 1; i < length; i++) {
|
| currentChar = identifier.codeUnitAt(i);
|
| if (!isLetterOrDigit(currentChar) &&
|
| @@ -181,6 +192,7 @@ RefactoringStatus _validateIdentifier(
|
| return new RefactoringStatus.fatal(message);
|
| }
|
| }
|
| + // OK
|
| return new RefactoringStatus();
|
| }
|
|
|
|
|