Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.resolver; | 5 library analyzer.src.generated.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 // _errorReporter.reportErrorForNode( | 975 // _errorReporter.reportErrorForNode( |
| 976 // HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE, | 976 // HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE, |
| 977 // node.name, | 977 // node.name, |
| 978 // [classElement.displayName]); | 978 // [classElement.displayName]); |
| 979 // return true; | 979 // return true; |
| 980 // } | 980 // } |
| 981 // } | 981 // } |
| 982 // return false; | 982 // return false; |
| 983 // } | 983 // } |
| 984 | 984 |
| 985 bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) => | 985 bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) { |
| 986 element != null && | 986 if (element == null) { |
| 987 (element.type == type || element.allSupertypes.contains(type)); | 987 return false; |
| 988 } | |
| 989 if (element.type == type) { | |
|
Brian Wilkerson
2016/06/06 20:23:00
I don't understand why this wouldn't be "element =
| |
| 990 return true; | |
| 991 } | |
| 992 ClassElement typeElement = type.element; | |
| 993 return element.allSupertypes | |
| 994 .any((InterfaceType t) => t.element == typeElement); | |
| 995 } | |
| 988 | 996 |
| 989 /** | 997 /** |
| 990 * Given a parenthesized expression, this returns the parent (or recursively g rand-parent) of the | 998 * Given a parenthesized expression, this returns the parent (or recursively g rand-parent) of the |
| 991 * expression that is a parenthesized expression, but whose parent is not a pa renthesized | 999 * expression that is a parenthesized expression, but whose parent is not a pa renthesized |
| 992 * expression. | 1000 * expression. |
| 993 * | 1001 * |
| 994 * For example given the code `(((e)))`: `(e) -> (((e)))`. | 1002 * For example given the code `(((e)))`: `(e) -> (((e)))`. |
| 995 * | 1003 * |
| 996 * @param parenthesizedExpression some expression whose parent is a parenthesi zed expression | 1004 * @param parenthesizedExpression some expression whose parent is a parenthesi zed expression |
| 997 * @return the first parent or grand-parent that is a parenthesized expression , that does not have | 1005 * @return the first parent or grand-parent that is a parenthesized expression , that does not have |
| (...skipping 9926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10924 return null; | 10932 return null; |
| 10925 } | 10933 } |
| 10926 if (identical(node.staticElement, variable)) { | 10934 if (identical(node.staticElement, variable)) { |
| 10927 if (node.inSetterContext()) { | 10935 if (node.inSetterContext()) { |
| 10928 result = true; | 10936 result = true; |
| 10929 } | 10937 } |
| 10930 } | 10938 } |
| 10931 return null; | 10939 return null; |
| 10932 } | 10940 } |
| 10933 } | 10941 } |
| OLD | NEW |