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 class AbstractVisitor<R> implements Visitor<R> { | 5 class AbstractVisitor<R> implements Visitor<R> { |
6 const AbstractVisitor(); | 6 const AbstractVisitor(); |
7 | 7 |
8 abstract R visitNode(Node node); | 8 abstract R visitNode(Node node); |
9 | 9 |
10 R visitBlock(Block node) => visitStatement(node); | 10 R visitBlock(Block node) => visitStatement(node); |
11 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); | 11 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); |
| 12 R visitCascade(Cascade node) => visitExpression(node); |
| 13 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); |
12 R visitCatchBlock(CatchBlock node) => visitNode(node); | 14 R visitCatchBlock(CatchBlock node) => visitNode(node); |
13 R visitClassNode(ClassNode node) => visitNode(node); | 15 R visitClassNode(ClassNode node) => visitNode(node); |
14 R visitConditional(Conditional node) => visitExpression(node); | 16 R visitConditional(Conditional node) => visitExpression(node); |
15 R visitContinueStatement(ContinueStatement node) => visitGotoStatement(node); | 17 R visitContinueStatement(ContinueStatement node) => visitGotoStatement(node); |
16 R visitDoWhile(DoWhile node) => visitLoop(node); | 18 R visitDoWhile(DoWhile node) => visitLoop(node); |
17 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); | 19 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); |
18 R visitExpression(Expression node) => visitNode(node); | 20 R visitExpression(Expression node) => visitNode(node); |
19 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); | 21 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); |
20 R visitFor(For node) => visitLoop(node); | 22 R visitFor(For node) => visitLoop(node); |
21 R visitForIn(ForIn node) => visitLoop(node); | 23 R visitForIn(ForIn node) => visitLoop(node); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 class TraversingVisitor extends AbstractVisitor { | 77 class TraversingVisitor extends AbstractVisitor { |
76 final Visitor visitor; | 78 final Visitor visitor; |
77 | 79 |
78 TraversingVisitor(Visitor this.visitor); | 80 TraversingVisitor(Visitor this.visitor); |
79 | 81 |
80 visitNode(Node node) { | 82 visitNode(Node node) { |
81 node.accept(visitor); | 83 node.accept(visitor); |
82 node.visitChildren(this); | 84 node.visitChildren(this); |
83 } | 85 } |
84 } | 86 } |
OLD | NEW |