OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of tree; | |
6 | |
7 /** | 5 /** |
8 * This visitor takes another visitor and applies it to every | 6 * This visitor takes another visitor and applies it to every |
9 * node in the tree. There is currently no way to control the | 7 * node in the tree. There is currently no way to control the |
10 * traversal. | 8 * traversal. |
11 */ | 9 */ |
12 class TraversingVisitor extends Visitor { | 10 class TraversingVisitor extends Visitor { |
13 final Visitor visitor; | 11 final Visitor visitor; |
14 | 12 |
15 TraversingVisitor(Visitor this.visitor); | 13 TraversingVisitor(Visitor this.visitor); |
16 | 14 |
17 visitNode(Node node) { | 15 visitNode(Node node) { |
18 node.accept(visitor); | 16 node.accept(visitor); |
19 node.visitChildren(this); | 17 node.visitChildren(this); |
20 } | 18 } |
21 } | 19 } |
OLD | NEW |