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