| 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 /** |
| 6 * Defines element visitors that support useful patterns for visiting the |
| 7 * elements in an [element model](element.dart). |
| 8 * |
| 9 * Dart is an evolving language, and the element model must evolved with it. |
| 10 * When the element model changes, the visitor interface will sometimes change |
| 11 * as well. If it is desirable to get a compilation error when the structure of |
| 12 * the element model has been modified, then you should consider implementing |
| 13 * the interface [ElementVisitor] directly. Doing so will ensure that changes |
| 14 * that introduce new classes of elements will be flagged. (Of course, not all |
| 15 * changes to the element model require the addition of a new class of element, |
| 16 * and hence cannot be caught this way.) |
| 17 * |
| 18 * But if automatic detection of these kinds of changes is not necessary then |
| 19 * you will probably want to extend one of the classes in this library because |
| 20 * doing so will simplify the task of writing your visitor and guard against |
| 21 * future changes to the element model. For example, the |
| 22 * [RecursiveElementVisitor] automates the process of visiting all of the |
| 23 * descendants of an element. |
| 24 */ |
| 5 library analyzer.dart.element.visitor; | 25 library analyzer.dart.element.visitor; |
| 6 | 26 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 27 import 'package:analyzer/dart/element/element.dart'; |
| 8 | 28 |
| 9 /** | 29 /** |
| 10 * An element visitor that will recursively visit all of the elements in an | 30 * An element visitor that will recursively visit all of the elements in an |
| 11 * element model (like instances of the class [RecursiveElementVisitor]). In | 31 * element model (like instances of the class [RecursiveElementVisitor]). In |
| 12 * addition, when an element of a specific type is visited not only will the | 32 * addition, when an element of a specific type is visited not only will the |
| 13 * visit method for that specific type of element be invoked, but additional | 33 * visit method for that specific type of element be invoked, but additional |
| 14 * methods for the supertypes of that element will also be invoked. For example, | 34 * methods for the supertypes of that element will also be invoked. For example, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 367 |
| 348 @override | 368 @override |
| 349 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; | 369 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; |
| 350 | 370 |
| 351 @override | 371 @override |
| 352 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; | 372 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; |
| 353 | 373 |
| 354 @override | 374 @override |
| 355 R visitTypeParameterElement(TypeParameterElement element) => null; | 375 R visitTypeParameterElement(TypeParameterElement element) => null; |
| 356 } | 376 } |
| OLD | NEW |