OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_ast; | 5 part of js_ast; |
6 | 6 |
7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 T visitInterpolatedExpression(InterpolatedExpression node); | 75 T visitInterpolatedExpression(InterpolatedExpression node); |
76 T visitInterpolatedLiteral(InterpolatedLiteral node); | 76 T visitInterpolatedLiteral(InterpolatedLiteral node); |
77 T visitInterpolatedParameter(InterpolatedParameter node); | 77 T visitInterpolatedParameter(InterpolatedParameter node); |
78 T visitInterpolatedSelector(InterpolatedSelector node); | 78 T visitInterpolatedSelector(InterpolatedSelector node); |
79 T visitInterpolatedStatement(InterpolatedStatement node); | 79 T visitInterpolatedStatement(InterpolatedStatement node); |
80 T visitInterpolatedDeclaration(InterpolatedDeclaration node); | 80 T visitInterpolatedDeclaration(InterpolatedDeclaration node); |
81 } | 81 } |
82 | 82 |
83 class BaseVisitor<T> implements NodeVisitor<T> { | 83 class BaseVisitor<T> implements NodeVisitor<T> { |
| 84 const BaseVisitor(); |
| 85 |
84 T visitNode(Node node) { | 86 T visitNode(Node node) { |
85 node.visitChildren(this); | 87 node.visitChildren(this); |
86 return null; | 88 return null; |
87 } | 89 } |
88 | 90 |
89 T visitProgram(Program node) => visitNode(node); | 91 T visitProgram(Program node) => visitNode(node); |
90 | 92 |
91 T visitStatement(Statement node) => visitNode(node); | 93 T visitStatement(Statement node) => visitNode(node); |
92 T visitLoop(Loop node) => visitStatement(node); | 94 T visitLoop(Loop node) => visitStatement(node); |
93 T visitJump(Statement node) => visitStatement(node); | 95 T visitJump(Statement node) => visitStatement(node); |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 class Comment extends Statement { | 1289 class Comment extends Statement { |
1288 final String comment; | 1290 final String comment; |
1289 | 1291 |
1290 Comment(this.comment); | 1292 Comment(this.comment); |
1291 | 1293 |
1292 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1294 accept(NodeVisitor visitor) => visitor.visitComment(this); |
1293 Comment _clone() => new Comment(comment); | 1295 Comment _clone() => new Comment(comment); |
1294 | 1296 |
1295 void visitChildren(NodeVisitor visitor) {} | 1297 void visitChildren(NodeVisitor visitor) {} |
1296 } | 1298 } |
OLD | NEW |