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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 734403004: cleanup hints (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index d78f8032e54719f7cfbf22e23d1bc4462e84cebe..45ba01d0d4f70eafccfaacf1cc94ceb2df5ab77c 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -700,7 +700,7 @@ class AngularCompilationUnitBuilder {
* violations of Dart best practices.
*/
class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
- static String _HASHCODE_GETTER_NAME = "hashCode";
+// static String _HASHCODE_GETTER_NAME = "hashCode";
static String _NULL_TYPE_NAME = "Null";
@@ -1254,26 +1254,26 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if a hint code is generated on the passed node
* See [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE].
*/
- bool _checkForOverrideEqualsButNotHashCode(ClassDeclaration node) {
- ClassElement classElement = node.element;
- if (classElement == null) {
- return false;
- }
- MethodElement equalsOperatorMethodElement =
- classElement.getMethod(sc.TokenType.EQ_EQ.lexeme);
- if (equalsOperatorMethodElement != null) {
- PropertyAccessorElement hashCodeElement =
- classElement.getGetter(_HASHCODE_GETTER_NAME);
- if (hashCodeElement == null) {
- _errorReporter.reportErrorForNode(
- HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
- node.name,
- [classElement.displayName]);
- return true;
- }
- }
- return false;
- }
+// bool _checkForOverrideEqualsButNotHashCode(ClassDeclaration node) {
+// ClassElement classElement = node.element;
+// if (classElement == null) {
+// return false;
+// }
+// MethodElement equalsOperatorMethodElement =
+// classElement.getMethod(sc.TokenType.EQ_EQ.lexeme);
+// if (equalsOperatorMethodElement != null) {
+// PropertyAccessorElement hashCodeElement =
+// classElement.getGetter(_HASHCODE_GETTER_NAME);
+// if (hashCodeElement == null) {
+// _errorReporter.reportErrorForNode(
+// HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
+// node.name,
+// [classElement.displayName]);
+// return true;
+// }
+// }
+// return false;
+// }
/**
* Check for the passed as expression for the [HintCode.UNNECESSARY_CAST] hint code.
@@ -11281,7 +11281,7 @@ class PolymerCompilationUnitBuilder {
* pub best practices.
*/
class PubVerifier extends RecursiveAstVisitor<Object> {
- static String _PUBSPEC_YAML = "pubspec.yaml";
+// static String _PUBSPEC_YAML = "pubspec.yaml";
/**
* The analysis context containing the sources to be analyzed
@@ -11310,47 +11310,47 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* See [PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE].
*/
- bool
- _checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral,
- String path) {
- Source source = _getSource(uriLiteral);
- String fullName = _getSourceFullName(source);
- if (fullName != null) {
- int pathIndex = 0;
- int fullNameIndex = fullName.length;
- while (pathIndex < path.length &&
- StringUtilities.startsWith3(path, pathIndex, 0x2E, 0x2E, 0x2F)) {
- fullNameIndex = JavaString.lastIndexOf(fullName, '/', fullNameIndex);
- if (fullNameIndex < 4) {
- return false;
- }
- // Check for "/lib" at a specified place in the fullName
- if (StringUtilities.startsWith4(
- fullName,
- fullNameIndex - 4,
- 0x2F,
- 0x6C,
- 0x69,
- 0x62)) {
- String relativePubspecPath =
- path.substring(0, pathIndex + 3) +
- _PUBSPEC_YAML;
- Source pubspecSource =
- _context.sourceFactory.resolveUri(source, relativePubspecPath);
- if (_context.exists(pubspecSource)) {
- // Files inside the lib directory hierarchy should not reference
- // files outside
- _errorReporter.reportErrorForNode(
- HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
- uriLiteral);
- }
- return true;
- }
- pathIndex += 3;
- }
- }
- return false;
- }
+// bool
+// _checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral,
+// String path) {
+// Source source = _getSource(uriLiteral);
+// String fullName = _getSourceFullName(source);
+// if (fullName != null) {
+// int pathIndex = 0;
+// int fullNameIndex = fullName.length;
+// while (pathIndex < path.length &&
+// StringUtilities.startsWith3(path, pathIndex, 0x2E, 0x2E, 0x2F)) {
+// fullNameIndex = JavaString.lastIndexOf(fullName, '/', fullNameIndex);
+// if (fullNameIndex < 4) {
+// return false;
+// }
+// // Check for "/lib" at a specified place in the fullName
+// if (StringUtilities.startsWith4(
+// fullName,
+// fullNameIndex - 4,
+// 0x2F,
+// 0x6C,
+// 0x69,
+// 0x62)) {
+// String relativePubspecPath =
+// path.substring(0, pathIndex + 3) +
+// _PUBSPEC_YAML;
+// Source pubspecSource =
+// _context.sourceFactory.resolveUri(source, relativePubspecPath);
+// if (_context.exists(pubspecSource)) {
+// // Files inside the lib directory hierarchy should not reference
+// // files outside
+// _errorReporter.reportErrorForNode(
+// HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
+// uriLiteral);
+// }
+// return true;
+// }
+// pathIndex += 3;
+// }
+// }
+// return false;
+// }
/**
* This verifies that the passed file import directive is not contained in a source outside a
@@ -11362,56 +11362,56 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* See [PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE].
*/
- bool
- _checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral,
- String path) {
- if (StringUtilities.startsWith4(path, 0, 0x6C, 0x69, 0x62, 0x2F)) {
- if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(
- uriLiteral,
- path,
- 0)) {
- return true;
- }
- }
- int pathIndex =
- StringUtilities.indexOf5(path, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
- while (pathIndex != -1) {
- if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(
- uriLiteral,
- path,
- pathIndex + 1)) {
- return true;
- }
- pathIndex =
- StringUtilities.indexOf5(path, pathIndex + 4, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
- }
- return false;
- }
+// bool
+// _checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral,
+// String path) {
+// if (StringUtilities.startsWith4(path, 0, 0x6C, 0x69, 0x62, 0x2F)) {
+// if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(
+// uriLiteral,
+// path,
+// 0)) {
+// return true;
+// }
+// }
+// int pathIndex =
+// StringUtilities.indexOf5(path, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
+// while (pathIndex != -1) {
+// if (_checkForFileImportOutsideLibReferencesFileInsideAtIndex(
+// uriLiteral,
+// path,
+// pathIndex + 1)) {
+// return true;
+// }
+// pathIndex =
+// StringUtilities.indexOf5(path, pathIndex + 4, 0x2F, 0x6C, 0x69, 0x62, 0x2F);
+// }
+// return false;
+// }
- bool
- _checkForFileImportOutsideLibReferencesFileInsideAtIndex(StringLiteral uriLiteral,
- String path, int pathIndex) {
- Source source = _getSource(uriLiteral);
- String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
- Source pubspecSource =
- _context.sourceFactory.resolveUri(source, relativePubspecPath);
- if (!_context.exists(pubspecSource)) {
- return false;
- }
- String fullName = _getSourceFullName(source);
- if (fullName != null) {
- if (StringUtilities.indexOf5(fullName, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F) <
- 0) {
- // Files outside the lib directory hierarchy should not reference files
- // inside ... use package: url instead
- _errorReporter.reportErrorForNode(
- HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE,
- uriLiteral);
- return true;
- }
- }
- return false;
- }
+// bool
+// _checkForFileImportOutsideLibReferencesFileInsideAtIndex(StringLiteral uriLiteral,
+// String path, int pathIndex) {
+// Source source = _getSource(uriLiteral);
+// String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
+// Source pubspecSource =
+// _context.sourceFactory.resolveUri(source, relativePubspecPath);
+// if (!_context.exists(pubspecSource)) {
+// return false;
+// }
+// String fullName = _getSourceFullName(source);
+// if (fullName != null) {
+// if (StringUtilities.indexOf5(fullName, 0, 0x2F, 0x6C, 0x69, 0x62, 0x2F) <
+// 0) {
+// // Files outside the lib directory hierarchy should not reference files
+// // inside ... use package: url instead
+// _errorReporter.reportErrorForNode(
+// HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE,
+// uriLiteral);
+// return true;
+// }
+// }
+// return false;
+// }
/**
* This verifies that the passed package import directive does not contain ".."
@@ -11421,18 +11421,18 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @return `true` if and only if an error code is generated on the passed node
* See [PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT].
*/
- bool _checkForPackageImportContainsDotDot(StringLiteral uriLiteral,
- String path) {
- if (StringUtilities.startsWith3(path, 0, 0x2E, 0x2E, 0x2F) ||
- StringUtilities.indexOf4(path, 0, 0x2F, 0x2E, 0x2E, 0x2F) >= 0) {
- // Package import should not to contain ".."
- _errorReporter.reportErrorForNode(
- HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT,
- uriLiteral);
- return true;
- }
- return false;
- }
+// bool _checkForPackageImportContainsDotDot(StringLiteral uriLiteral,
+// String path) {
+// if (StringUtilities.startsWith3(path, 0, 0x2E, 0x2E, 0x2F) ||
+// StringUtilities.indexOf4(path, 0, 0x2F, 0x2E, 0x2E, 0x2F) >= 0) {
+// // Package import should not to contain ".."
+// _errorReporter.reportErrorForNode(
+// HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT,
+// uriLiteral);
+// return true;
+// }
+// return false;
+// }
/**
* Answer the source associated with the compilation unit containing the given AST node.
@@ -11440,17 +11440,17 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @param node the node (not `null`)
* @return the source or `null` if it could not be determined
*/
- Source _getSource(AstNode node) {
- Source source = null;
- CompilationUnit unit = node.getAncestor((node) => node is CompilationUnit);
- if (unit != null) {
- CompilationUnitElement element = unit.element;
- if (element != null) {
- source = element.source;
- }
- }
- return source;
- }
+// Source _getSource(AstNode node) {
+// Source source = null;
+// CompilationUnit unit = node.getAncestor((node) => node is CompilationUnit);
+// if (unit != null) {
+// CompilationUnitElement element = unit.element;
+// if (element != null) {
+// source = element.source;
+// }
+// }
+// return source;
+// }
/**
* Answer the full name of the given source. The returned value will have all
@@ -11459,15 +11459,15 @@ class PubVerifier extends RecursiveAstVisitor<Object> {
* @param source the source
* @return the full name or `null` if it could not be determined
*/
- String _getSourceFullName(Source source) {
- if (source != null) {
- String fullName = source.fullName;
- if (fullName != null) {
- return fullName.replaceAll(r'\', '/');
- }
- }
- return null;
- }
+// String _getSourceFullName(Source source) {
+// if (source != null) {
+// String fullName = source.fullName;
+// if (fullName != null) {
+// return fullName.replaceAll(r'\', '/');
+// }
+// }
+// return null;
+// }
}
class RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews extends
« pkg/analyzer/lib/src/generated/engine.dart ('K') | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698