| 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.dart.element.element; | 5 library analyzer.src.dart.element.element; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 assert(false); | 201 assert(false); |
| 202 return false; | 202 return false; |
| 203 } | 203 } |
| 204 // Find the nearest class in the supertype chain that is not a mixin | 204 // Find the nearest class in the supertype chain that is not a mixin |
| 205 // application. | 205 // application. |
| 206 ClassElement nearestNonMixinClass = supertype.element; | 206 ClassElement nearestNonMixinClass = supertype.element; |
| 207 if (nearestNonMixinClass.isMixinApplication) { | 207 if (nearestNonMixinClass.isMixinApplication) { |
| 208 // Use a list to keep track of the classes we've seen, so that we won't | 208 // Use a list to keep track of the classes we've seen, so that we won't |
| 209 // go into an infinite loop in the event of a non-trivial loop in the | 209 // go into an infinite loop in the event of a non-trivial loop in the |
| 210 // class hierarchy. | 210 // class hierarchy. |
| 211 List<ClassElementImpl> classesSeen = <ClassElementImpl>[this]; | 211 List<ClassElement> classesSeen = <ClassElement>[this]; |
| 212 while (nearestNonMixinClass.isMixinApplication) { | 212 while (nearestNonMixinClass.isMixinApplication) { |
| 213 if (classesSeen.contains(nearestNonMixinClass)) { | 213 if (classesSeen.contains(nearestNonMixinClass)) { |
| 214 // Loop in the class hierarchy (which is reported elsewhere). Don't | 214 // Loop in the class hierarchy (which is reported elsewhere). Don't |
| 215 // confuse the user with further errors. | 215 // confuse the user with further errors. |
| 216 return false; | 216 return false; |
| 217 } | 217 } |
| 218 classesSeen.add(nearestNonMixinClass); | 218 classesSeen.add(nearestNonMixinClass); |
| 219 if (nearestNonMixinClass.supertype == null) { | 219 if (nearestNonMixinClass.supertype == null) { |
| 220 // Should never happen, since Object is the only class that has no | 220 // Should never happen, since Object is the only class that has no |
| 221 // supertype, and it is not a mixin application. | 221 // supertype, and it is not a mixin application. |
| (...skipping 4815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5037 | 5037 |
| 5038 @override | 5038 @override |
| 5039 void visitElement(Element element) { | 5039 void visitElement(Element element) { |
| 5040 int offset = element.nameOffset; | 5040 int offset = element.nameOffset; |
| 5041 if (offset != -1) { | 5041 if (offset != -1) { |
| 5042 map[offset] = element; | 5042 map[offset] = element; |
| 5043 } | 5043 } |
| 5044 super.visitElement(element); | 5044 super.visitElement(element); |
| 5045 } | 5045 } |
| 5046 } | 5046 } |
| OLD | NEW |