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 services.search.element_visitors; | 5 library services.search.element_visitors; |
6 | 6 |
7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/visitor.dart'; |
8 | 9 |
9 /** | 10 /** |
10 * Uses [processor] to visit all of the children of [element]. | 11 * Uses [processor] to visit all of the children of [element]. |
11 * If [processor] returns `true`, then children of a child are visited too. | 12 * If [processor] returns `true`, then children of a child are visited too. |
12 */ | 13 */ |
13 void visitChildren(Element element, ElementProcessor processor) { | 14 void visitChildren(Element element, ElementProcessor processor) { |
14 element.visitChildren(new _ElementVisitorAdapter(processor)); | 15 element.visitChildren(new _ElementVisitorAdapter(processor)); |
15 } | 16 } |
16 | 17 |
17 /** | 18 /** |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 @override | 57 @override |
57 void visitElement(Element element) { | 58 void visitElement(Element element) { |
58 if (element is CompilationUnitElement) { | 59 if (element is CompilationUnitElement) { |
59 element.visitChildren(this); | 60 element.visitChildren(this); |
60 } else { | 61 } else { |
61 processor(element); | 62 processor(element); |
62 } | 63 } |
63 } | 64 } |
64 } | 65 } |
OLD | NEW |